fix: 🐛 Fix breaking change for changing page size (#2398)

This commit is contained in:
Zhihe Li authored and GitHub committed 2024-07-17 16:17:17 -04:00
1 parent bea40ec622
commit ec59ee2b1c
2 files changed
+10

No files matched your search

@@ -10,4 +10,5 @@
@route={{this.router.currentRouteName}}
@model={{@model}}
@queryFunction={{this.paginationQueryParams}}
@onPageSizeChange={{this.handlePageSizeChange}}
/>
@@ -5,6 +5,7 @@
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
export default class RosePaginationComponent extends Component {
@service router;
@@ -21,4 +22,12 @@ export default class RosePaginationComponent extends Component {
};
};
}
@action
async handlePageSizeChange(pageSize) {
// Reset to the first page when changing the page size
const queryParams = { page: 1, pageSize };
await this.router.transitionTo({ queryParams });
}
}