Skip to content

Commit

Permalink
fix: catalog page composer (#234)
Browse files Browse the repository at this point in the history
* chore: update pkg lock

* fix: skip reset params for pagination
  • Loading branch information
ljiang-ti committed Nov 14, 2023
1 parent bdb155d commit 0cdbec7
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 50 deletions.
80 changes: 40 additions & 40 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,6 @@ describe('@thoughtindustries/catalog/core/CatalogURLManager', () => {
const actual = manager.composeURLForSetPage(2);
expect(actual).toMatchInlineSnapshot(`"/base?token=abc&page=2"`);
});

it('should reset existing params and set page when is curated', () => {
const searchString =
'?labels=%5B%22label1%22%2C%22label2%22%5D&values=%5B%22value1%22%2C%22value2%22%5D&page=3&token=abc&query=test&content-types=%5B%22type1%22%5D&display-type=calendar&sort=createdAt%3Adesc';
const manager = setup({ searchString, isCurated: true });

const actual = manager.composeURLForSetPage(2);
expect(actual).toMatchInlineSnapshot(`"/base?page=2"`);
});
});

describe('composeURLForRemoveToken', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export default class CatalogURLManager {
}

composeURLForSetPage(page: number): string {
const clonedParams = this._resetOrDefaultClonedParams();
const clonedParams = new URLSearchParams(this._searchParams);
clonedParams.set(CatalogURLSearchParams.Page, page.toString());
return this._composeURL(clonedParams.toString());
}
Expand Down

0 comments on commit 0cdbec7

Please sign in to comment.