Skip to content

Commit

Permalink
Merge pull request #51547 from daledah/fix/50981
Browse files Browse the repository at this point in the history
fix: prevent open search when onboarding is not completed
  • Loading branch information
stitesExpensify authored Oct 30, 2024
2 parents cfeb1bf + 967eb0f commit 8655902
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/libs/Navigation/AppNavigator/AuthScreens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,12 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie
isInitialRender.current = false;
}

const isOnboardingCompletedRef = useRef(isOnboardingCompleted);

useEffect(() => {
isOnboardingCompletedRef.current = isOnboardingCompleted;
}, [isOnboardingCompleted]);

useEffect(() => {
const shortcutsOverviewShortcutConfig = CONST.KEYBOARD_SHORTCUTS.SHORTCUTS;
const searchShortcutConfig = CONST.KEYBOARD_SHORTCUTS.SEARCH;
Expand Down Expand Up @@ -362,6 +368,9 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie
searchShortcutConfig.shortcutKey,
() => {
Session.checkIfActionIsAllowed(() => {
if (!isOnboardingCompletedRef.current) {
return;
}
toggleSearchRouter();
})();
},
Expand Down

0 comments on commit 8655902

Please sign in to comment.