Skip to content

Commit

Permalink
Update dependency array on setPage useCallback hook (#3029)
Browse files Browse the repository at this point in the history
Changes:
Add the onChangeActivePage function to the dependency array of the setPage useCallback hook to ensure it always reflects the latest state.

Impact:
This fix ensures that the pagination component accurately reflects the current state when triggering onChangeActivePage.
  • Loading branch information
jesuzon authored May 24, 2024
1 parent f24a973 commit 07d722d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/hooks/use-pagination/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export function usePagination(props: UsePaginationProps) {
onChangeActivePage(pageNumber);
}
},
[total, activePage],
[total, activePage, onChangeActivePage],
);

const next = () => (isRTL ? setPage(activePage - 1) : setPage(activePage + 1));
Expand Down

0 comments on commit 07d722d

Please sign in to comment.