Skip to content

Commit d16efc8

Browse files
mountinyOSBotify
authored andcommitted
Merge pull request #92046 from Expensify/revert-91796-claude-fixTabNavigatorDeepLinkRace
[CP Staging] Revert "Wait for TabNavigator mount before resolving waitForProtectedRoutes" (cherry picked from commit 1a666a5) (cherry-picked to staging by mountiny)
1 parent 431df16 commit d16efc8

3 files changed

Lines changed: 2 additions & 37 deletions

File tree

src/libs/Navigation/Navigation.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import {isFullScreenName, isOnboardingFlowName, isSplitNavigatorName} from './he
3737
import isReportOpenInRHP from './helpers/isReportOpenInRHP';
3838
import isReportTopmostSplitNavigator from './helpers/isReportTopmostSplitNavigator';
3939
import isSideModalNavigator from './helpers/isSideModalNavigator';
40-
import isTabNavigatorReady from './helpers/isTabNavigatorReady';
4140
import linkTo from './helpers/linkTo';
4241
import getMinimalAction from './helpers/linkTo/getMinimalAction';
4342
import type {LinkToOptions} from './helpers/linkTo/types';
@@ -699,16 +698,8 @@ function navContainsProtectedRoutes(state: State | undefined): boolean {
699698
return false;
700699
}
701700

702-
if (!state.routeNames.includes(PROTECTED_SCREENS.CONCIERGE)) {
703-
return false;
704-
}
705-
706-
// routeNames only tells us screens are declared on the root navigator.
707-
// We also need TabNavigator to be mounted (its child router has run
708-
// useNavigationBuilder and produced a non-stale nested state), otherwise a
709-
// deferred NAVIGATE targeting a screen inside TabNavigator will be dispatched
710-
// before any child router is registered to handle it.
711-
return isTabNavigatorReady(state);
701+
// If one protected screen is in the routeNames then other screens are there as well.
702+
return state?.routeNames.includes(PROTECTED_SCREENS.CONCIERGE);
712703
}
713704

714705
/**

src/libs/Navigation/helpers/isTabNavigatorReady.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/libs/Navigation/linkingConfig/subscribe.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type {LinkingOptions} from '@react-navigation/native';
22
import {findFocusedRoute} from '@react-navigation/native';
33
import {Linking} from 'react-native';
44
import continuePlaidOAuth from '@libs/continuePlaidOAuth';
5-
import isTabNavigatorReady from '@libs/Navigation/helpers/isTabNavigatorReady';
65
import navigationRef from '@libs/Navigation/navigationRef';
76
import type {RootNavigatorParamList} from '@libs/Navigation/types';
87
import CONST from '@src/CONST';
@@ -32,16 +31,6 @@ const subscribe: LinkingOptions<RootNavigatorParamList>['subscribe'] = (listener
3231
continuePlaidOAuth(url);
3332
return;
3433
}
35-
// Skip forwarding URLs while TabNavigator is mounting — its child
36-
// router hasn't run useNavigationBuilder yet, so React Navigation
37-
// can't handle nested NAVIGATE actions and throws an unhandled-action
38-
// error. Protected-screen deep links will be handled separately by
39-
// openReportFromDeepLink via waitForProtectedRoutes().
40-
const state = navigationRef.current?.getRootState();
41-
if (!isTabNavigatorReady(state)) {
42-
return;
43-
}
44-
4534
listener(url);
4635
});
4736
return () => subscription.remove();

0 commit comments

Comments
 (0)