dequelabs / dequelabs/cauldron
usePagination does not update when the total number of issues changes
- Dominant language
- TypeScript
- Stars
- 127
- Forks
- 31
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 8
Description
Currently, the [usePagination](https://github.com/dequelabs/cauldron/blob/develop/packages/react/src/components/Pagination/usePagination.tsx) hook does not gracefully handle when the total number of issues changes, which makes it unusable in situations where the items are filtered.
If `totalItems` changes to a number that would make the `currentPage`, `pageStart` , or `pageEnd` invalid (such as by changing to a smaller number of total items resulting in `currentPage` being higher than the total number of items), then the pagination state should update to valid values.
If the `currentPage` is higher than the total number of items, it should update to the last valid page, or the first page if the total number of items is `0`.
Contributor guide
Assessment
This issue has not been assessed yet.