Skip to content

Commit

Permalink
Remove Navigation.removeScreenFromNavigationState
Browse files Browse the repository at this point in the history
  • Loading branch information
WojtekBoman committed Nov 25, 2024
1 parent 1245af4 commit 06f10a6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 25 deletions.
16 changes: 0 additions & 16 deletions src/libs/Navigation/Navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -461,20 +460,6 @@ const dismissModalWithReport = (report: OnyxEntry<Report>) => {
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,
Expand All @@ -499,7 +484,6 @@ export default {
setNavigationActionToMicrotaskQueue,
navigateToReportWithPolicyCheck,
goUp,
removeScreenFromNavigationState,
};

export {navigationRef};
9 changes: 0 additions & 9 deletions src/pages/workspace/AccessOrNotFoundWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 <FullscreenLoadingIndicator />;
}
Expand Down

0 comments on commit 06f10a6

Please sign in to comment.