diff --git a/src/libs/Navigation/Navigation.ts b/src/libs/Navigation/Navigation.ts index 4ef2cbb6255f..8013eb6c20c3 100644 --- a/src/libs/Navigation/Navigation.ts +++ b/src/libs/Navigation/Navigation.ts @@ -17,7 +17,6 @@ import NAVIGATORS from '@src/NAVIGATORS'; import ONYXKEYS from '@src/ONYXKEYS'; import type {HybridAppRoute, Route} from '@src/ROUTES'; import ROUTES, {HYBRID_APP_ROUTES} from '@src/ROUTES'; -import type {Screen} from '@src/SCREENS'; import SCREENS, {PROTECTED_SCREENS} from '@src/SCREENS'; import type {Report} from '@src/types/onyx'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; @@ -461,20 +460,6 @@ const dismissModalWithReport = (report: OnyxEntry) => { isNavigationReady().then(() => navigateToReportWithPolicyCheck({report})); }; -function removeScreenFromNavigationState(screen: Screen) { - isNavigationReady().then(() => { - navigationRef.dispatch((state) => { - const routes = state.routes?.filter((item) => item.name !== screen); - - return CommonActions.reset({ - ...state, - routes, - index: routes.length < state.routes.length ? state.index - 1 : state.index, - }); - }); - }); -} - export default { setShouldPopAllStateOnUP, navigate, @@ -499,7 +484,6 @@ export default { setNavigationActionToMicrotaskQueue, navigateToReportWithPolicyCheck, goUp, - removeScreenFromNavigationState, }; export {navigationRef}; diff --git a/src/pages/workspace/AccessOrNotFoundWrapper.tsx b/src/pages/workspace/AccessOrNotFoundWrapper.tsx index 7a260d876371..83a24e2084d3 100644 --- a/src/pages/workspace/AccessOrNotFoundWrapper.tsx +++ b/src/pages/workspace/AccessOrNotFoundWrapper.tsx @@ -17,7 +17,6 @@ import type {IOUType} from '@src/CONST'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; -import SCREENS from '@src/SCREENS'; import type * as OnyxTypes from '@src/types/onyx'; import type {PolicyFeatureName} from '@src/types/onyx/Policy'; import callOrReturn from '@src/types/utils/callOrReturn'; @@ -166,14 +165,6 @@ function AccessOrNotFoundWrapper({ setIsPolicyFeatureEnabled(isFeatureEnabled); }, [pendingField, isOffline, isFeatureEnabled]); - useEffect(() => { - // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - if (isLoadingReportData || !isPolicyNotAccessible) { - return; - } - Navigation.removeScreenFromNavigationState(SCREENS.WORKSPACE.INITIAL); - }, [isLoadingReportData, isPolicyNotAccessible]); - if (shouldShowFullScreenLoadingIndicator) { return ; }