Skip to content

Commit 0842705

Browse files
committed
fix: clear existing timeout before setting a new one
1 parent 9ea1b6b commit 0842705

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/onchainkit/src/fund/hooks/useFundCardSetupOnrampEventListeners.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ export const useFundCardSetupOnrampEventListeners = () => {
99
const timeoutRef = useRef<NodeJS.Timeout | null>(null);
1010

1111
const scheduleFundButtonReset = useCallback(() => {
12+
if (timeoutRef.current) {
13+
clearTimeout(timeoutRef.current);
14+
}
15+
1216
timeoutRef.current = setTimeout(() => {
1317
setSubmitButtonState('default');
1418
}, FUND_BUTTON_RESET_TIMEOUT);

0 commit comments

Comments
 (0)