From f8a926b872c189024ff7a47c50972d456d91c390 Mon Sep 17 00:00:00 2001 From: Filip Solecki Date: Tue, 30 Jan 2024 14:19:22 +0100 Subject: [PATCH] Fix goBack when workspace with given policyID does not exist --- src/pages/workspace/WorkspacePageWithSections.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pages/workspace/WorkspacePageWithSections.tsx b/src/pages/workspace/WorkspacePageWithSections.tsx index 3e6e47000a4a..b4aaaf76446c 100644 --- a/src/pages/workspace/WorkspacePageWithSections.tsx +++ b/src/pages/workspace/WorkspacePageWithSections.tsx @@ -104,7 +104,12 @@ function WorkspacePageWithSections({ const {isSmallScreenWidth} = useWindowDimensions(); const firstRender = useRef(true); - const goBack = () => Navigation.goBack(ROUTES.SETTINGS_WORKSPACES); + const goBack = () => { + Navigation.goBack(ROUTES.SETTINGS_WORKSPACES); + + // Needed when workspace with given policyID does not exist + Navigation.navigateWithSwitchPolicyID({route: ROUTES.ALL_SETTINGS}); + }; useEffect(() => { // Because isLoading is false before merging in Onyx, we need firstRender ref to display loading page as well before isLoading is change to true