Skip to content

Commit

Permalink
Merge pull request #529 from InseeFr/fix/v3-save-on-lastpage
Browse files Browse the repository at this point in the history
save on click on last page
  • Loading branch information
ddecrulle authored Jan 24, 2024
2 parents fd15056 + 7f05c9d commit 60541dc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/orchestrator/UseLunatic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,13 @@ export function UseLunatic(props: PropsWithChildren<OrchestratorProps>) {
previousPageTag !== pageTag;

const handleGoNext = useCallback(() => {
shouldSync.current = true;
goNextPage?.();
}, [goNextPage]);
if (isLastPage) {
saveChange({ pageTag, getData });
} else {
shouldSync.current = true;
goNextPage?.();
}
}, [goNextPage, isLastPage, saveChange, pageTag, getData]);

const handleGoBack = useCallback(() => {
shouldSync.current = true;
Expand Down

0 comments on commit 60541dc

Please sign in to comment.