Skip to content

Commit

Permalink
Refactor switching workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
WojtekBoman committed Jan 19, 2024
1 parent 3354570 commit f6bfbf0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/libs/Navigation/Navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,10 @@ function waitForProtectedRoutes() {
}

function navigateWithSwitchPolicyID(policyID: string) {
goBack();
if (!canNavigate('navigateWithSwitchPolicyID')) {
return;
}

return switchPolicyID(navigationRef.current, policyID);
}

Expand Down
6 changes: 2 additions & 4 deletions src/pages/WorkspaceSwitcherPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,8 @@ function WorkspaceSwitcherPage({policies}) {
setSelectedOption(undefined);
}
setActiveWorkspaceID(policyID);

if (policyID === activeWorkspaceID) {
Navigation.goBack();
} else {
Navigation.goBack();
if (policyID !== activeWorkspaceID) {
Navigation.navigateWithSwitchPolicyID(policyID);
}
}, []);
Expand Down

0 comments on commit f6bfbf0

Please sign in to comment.