Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Fix useThrottledCallback trailing config #2851

Merged
merged 1 commit into from
Feb 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/mobile/src/hooks/useThrottledCallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export const useThrottledCallback = <T extends (...args: any) => any>(
wait: number,
deps: DependencyList
) => {
// eslint-disable-next-line react-hooks/exhaustive-deps
return useMemo(() => throttle(callback, wait), [wait, ...deps])
return useMemo(
() => throttle(callback, wait, { trailing: false }),
// eslint-disable-next-line react-hooks/exhaustive-deps
[wait, ...deps]
)
}