From 66498e12ce4d3bed751842ecae7c5a826cabfc13 Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Mon, 20 Oct 2025 12:40:20 +0500 Subject: [PATCH] mobile: fix multiple timers set on reset root state causing jank --- apps/mobile/app/components/auth/common.js | 3 --- apps/mobile/app/navigation/navigation-stack.tsx | 4 +++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/mobile/app/components/auth/common.js b/apps/mobile/app/components/auth/common.js index 88e62ff3d..255d4f96a 100644 --- a/apps/mobile/app/components/auth/common.js +++ b/apps/mobile/app/components/auth/common.js @@ -38,9 +38,6 @@ export function hideAuth(context) { context === "intro" ) { Navigation.replace("FluidPanelsView"); - setTimeout(() => { - Navigation.resetRootState(); - }, 1000); } else { Navigation.goBack(); } diff --git a/apps/mobile/app/navigation/navigation-stack.tsx b/apps/mobile/app/navigation/navigation-stack.tsx index f566ccc0f..52726e214 100644 --- a/apps/mobile/app/navigation/navigation-stack.tsx +++ b/apps/mobile/app/navigation/navigation-stack.tsx @@ -258,12 +258,14 @@ export const RootNavigation = () => { (state) => state.settings.introCompleted ); const clearSelection = useSelectionStore((state) => state.clearSelection); + const resetTimer = React.useRef(undefined); const onStateChange = React.useCallback( (state: any) => { if (useSelectionStore.getState().selectionMode) { clearSelection(); } - setTimeout(() => { + clearTimeout(resetTimer.current); + resetTimer.current = setTimeout(() => { Navigation.resetRootState(state); }, 1000); hideAllTooltips();