diff --git a/src/pages/workspace/AdminPolicyAccessOrNotFoundWrapper.tsx b/src/pages/workspace/AdminPolicyAccessOrNotFoundWrapper.tsx
index 5c8456366c6b..1fc4b51aca21 100644
--- a/src/pages/workspace/AdminPolicyAccessOrNotFoundWrapper.tsx
+++ b/src/pages/workspace/AdminPolicyAccessOrNotFoundWrapper.tsx
@@ -2,7 +2,9 @@
import React, {useEffect} from 'react';
import type {OnyxEntry} from 'react-native-onyx';
import {withOnyx} from 'react-native-onyx';
+import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView';
import FullscreenLoadingIndicator from '@components/FullscreenLoadingIndicator';
+import ScreenWrapper from '@components/ScreenWrapper';
import Navigation from '@libs/Navigation/Navigation';
import * as PolicyUtils from '@libs/PolicyUtils';
import NotFoundPage from '@pages/ErrorPage/NotFoundPage';
@@ -50,11 +52,25 @@ function AdminPolicyAccessOrNotFoundComponent(props: AdminPolicyAccessOrNotFound
}
if (shouldShowNotFoundPage) {
+ const isPolicyNotAccessible = isEmptyObject(props.policy) || !props.policy?.id;
+
+ if (isPolicyNotAccessible) {
+ return (
+
+ Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)}
+ />
+
+ );
+ }
return Navigation.goBack(ROUTES.WORKSPACE_PROFILE.getRoute(props.policyID))} />;
}
return typeof props.children === 'function' ? props.children(props) : props.children;
}
+AdminPolicyAccessOrNotFoundComponent.displayName = 'AdminPolicyAccessOrNotFoundComponent';
export default withOnyx({
policy: {