Skip to content

Commit

Permalink
Merge pull request #2015 from cprussin/fix-last-page-getting-dropped
Browse files Browse the repository at this point in the history
fix(staking): fix last page getting dropped
  • Loading branch information
cprussin authored Oct 9, 2024
2 parents a32f485 + 02e32f2 commit c991c29
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions apps/staking/src/components/OracleIntegrityStaking/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,16 @@ const PublisherList = ({
[setYoursFirst, updatePage],
);

const updatePageSize = useCallback<typeof setPageSize>(
(newPageSize) => {
setPageSize(newPageSize);
updatePage(1);
},
[setPageSize, updatePage],
);

const numPages = useMemo(
() => Math.floor(filteredSortedPublishers.length / pageSize),
() => Math.ceil(filteredSortedPublishers.length / pageSize),
[filteredSortedPublishers, pageSize],
);

Expand Down Expand Up @@ -836,7 +844,7 @@ const PublisherList = ({
label="Page size"
options={PageSize}
selectedKey={pageSize}
onSelectionChange={setPageSize}
onSelectionChange={updatePageSize}
/>
<Paginator
currentPage={currentPage}
Expand Down

0 comments on commit c991c29

Please sign in to comment.