Skip to content

Commit

Permalink
Fix issue with data not updating if there is only one page.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaddox5 committed Nov 8, 2024
1 parent decbb24 commit 8b4c7d5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions assets/src/components/v2/elevator/elevator_closures.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const OutsideClosureList = ({
const [rowPageIndexes, setRowPageIndexes] = useState<{
[key: number]: number;
}>({});

const numPages = Object.keys(rowPageIndexes).length;
const pageIndex = useClientPaging({ numPages, onFinish, lastUpdate });

Expand Down
4 changes: 3 additions & 1 deletion assets/src/hooks/v2/use_client_paging.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ const useClientPaging = ({ numPages, onFinish, lastUpdate }: Args) => {
if (lastUpdate != null) {
if (isFirstRender) {
setIsFirstRender(false);
} else {
} else if (numPages > 1) {
setPageIndex((i) => i + 1);
} else {
onFinish();
}
}
}, [lastUpdate]);
Expand Down

0 comments on commit 8b4c7d5

Please sign in to comment.