Skip to content

Commit 290a9d9

Browse files
authored
Merge pull request #46750 from tushar-a-b/fix/46026
Fix: Onboarding modal shows up after refreshing page with 2FA setup when xero connected and 2FA disabled
2 parents 3775dae + 0047ab6 commit 290a9d9

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/Expensify.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ function Expensify({
300300
authenticated={isAuthenticated}
301301
lastVisitedPath={lastVisitedPath as Route}
302302
initialUrl={initialUrl}
303+
shouldShowRequire2FAModal={shouldShowRequire2FAModal}
303304
/>
304305
</SplashScreenHiddenContext.Provider>
305306
)}

src/libs/Navigation/AppNavigator/AuthScreens.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie
224224
}
225225

226226
if (!initialReportID) {
227-
initialReportID = ReportUtils.findLastAccessedReport(!canUseDefaultRooms, shouldOpenOnAdminRoom(), activeWorkspaceID)?.reportID;
227+
const initialReport = ReportUtils.findLastAccessedReport(!canUseDefaultRooms, shouldOpenOnAdminRoom(), activeWorkspaceID);
228+
initialReportID = initialReport?.reportID ?? '';
228229
}
229230

230231
isInitialRender.current = false;

src/libs/Navigation/NavigationRoot.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ type NavigationRootProps = {
3939

4040
/** Fired when react-navigation is ready */
4141
onReady: () => void;
42+
43+
/** Flag to indicate if the require 2FA modal should be shown to the user */
44+
shouldShowRequire2FAModal: boolean;
4245
};
4346

4447
/**
@@ -73,7 +76,7 @@ function parseAndLogRoute(state: NavigationState) {
7376
}
7477
}
7578

76-
function NavigationRoot({authenticated, lastVisitedPath, initialUrl, onReady}: NavigationRootProps) {
79+
function NavigationRoot({authenticated, lastVisitedPath, initialUrl, onReady, shouldShowRequire2FAModal}: NavigationRootProps) {
7780
const firstRenderRef = useRef(true);
7881
const theme = useTheme();
7982
const {cleanStaleScrollOffsets} = useContext(ScrollOffsetContext);
@@ -94,7 +97,7 @@ function NavigationRoot({authenticated, lastVisitedPath, initialUrl, onReady}: N
9497

9598
// If the user haven't completed the flow, we want to always redirect them to the onboarding flow.
9699
// We also make sure that the user is authenticated.
97-
if (!hasCompletedGuidedSetupFlow && authenticated) {
100+
if (!hasCompletedGuidedSetupFlow && authenticated && !shouldShowRequire2FAModal) {
98101
const {adaptedState} = getAdaptedStateFromPath(ROUTES.ONBOARDING_ROOT.route, linkingConfig.config);
99102
return adaptedState;
100103
}

0 commit comments

Comments
 (0)