Skip to content

Commit a591c6c

Browse files
committed
fix: when changing itemsPerPage, also reset page to 0
consider this case: - there are 11 items - itemsPerPage is 10 - so there are 2 pages - you go to page 2 - you change itemsPerPage to 100 - now there's just 1 page, to be precise: 11 items on the first page - the 2nd page shows nothing before this commit if the above situation happened, you'd just get a "no results" page - i think it's safer to redirect to page 0 when changing itemsPerPage to avoid the case described above
1 parent dbd15f0 commit a591c6c

File tree

1 file changed

+1
-0
lines changed
  • packages/theme/composables/useUiHelpers

1 file changed

+1
-0
lines changed

packages/theme/composables/useUiHelpers/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export function useUiHelpers(): UseUiHelpersInterface {
137137
const query = {
138138
...getFiltersDataFromUrl(false),
139139
itemsPerPage: itemsPerPage.toString(10),
140+
page: '0',
140141
};
141142

142143
if (forcePush) {

0 commit comments

Comments
 (0)