Skip to content

Commit

Permalink
change debounce time to 150
Browse files Browse the repository at this point in the history
  • Loading branch information
sashankaryal committed Oct 30, 2024
1 parent 91efe43 commit 6df55b0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/packages/core/src/components/Modal/ModalNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,15 @@ const ModalNavigation = ({ onNavigate }: { onNavigate: () => void }) => {

modalRef.current = modal;

// important: make sure all dependencies of the navigators are referentially stable,
// or else the debouncing mechanism won't work
const nextNavigator = useMemo(
() =>
createDebouncedNavigator({
isNavigationIllegalWhen: () => modalRef.current?.hasNext === false,
navigateFn: (offset) => navigation?.next(offset).then(setModal),
onNavigationStart: onNavigate,
debounceTime: 200,
debounceTime: 150,
}),
[navigation, onNavigate, setModal]
);
Expand All @@ -85,7 +87,7 @@ const ModalNavigation = ({ onNavigate }: { onNavigate: () => void }) => {
isNavigationIllegalWhen: () => modalRef.current?.hasPrevious === false,
navigateFn: (offset) => navigation?.previous(offset).then(setModal),
onNavigationStart: onNavigate,
debounceTime: 200,
debounceTime: 150,
}),
[navigation, onNavigate, setModal]
);
Expand Down

0 comments on commit 6df55b0

Please sign in to comment.