Skip to content

Commit

Permalink
Remove backTo param from Workspace Initial Page
Browse files Browse the repository at this point in the history
  • Loading branch information
WojtekBoman committed Dec 18, 2024
1 parent f405f7e commit 2e08e1e
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,6 @@ function adaptStateIfNecessary({state, options: {sidebarScreen, defaultCentralSc
const paramsFromRoute = getParamsFromRoute(sidebarScreen);
let params = pick(lastRoute?.params, paramsFromRoute);

Check failure on line 46 in src/libs/Navigation/AppNavigator/createSplitNavigator/SplitRouter.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'params' is never reassigned. Use 'const' instead

Check failure on line 46 in src/libs/Navigation/AppNavigator/createSplitNavigator/SplitRouter.ts

View workflow job for this annotation

GitHub Actions / ESLint check

'params' is never reassigned. Use 'const' instead

// On a wide screen the backTo param has to be passed to the sidebar screen (SCREENS.WORKSPACE.INITIAL), because the back action is performed from this page
if (lastRoute?.name === SCREENS.WORKSPACE.PROFILE) {
const hasRouteBackToParam = lastRoute?.params && 'backTo' in lastRoute.params;

if (hasRouteBackToParam) {
params = {...params, backTo: lastRoute.params.backTo};
}
}

// @ts-expect-error Updating read only property
// noinspection JSConstantReassignment
state.stale = true; // eslint-disable-line
Expand Down
1 change: 0 additions & 1 deletion src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1422,7 +1422,6 @@ type SettingsSplitNavigatorParamList = {
type WorkspaceSplitNavigatorParamList = {
[SCREENS.WORKSPACE.INITIAL]: {
policyID: string;
backTo?: string;
};
[SCREENS.WORKSPACE.PROFILE]: {
policyID: string;
Expand Down
9 changes: 1 addition & 8 deletions src/pages/workspace/WorkspaceInitialPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -406,14 +406,7 @@ function WorkspaceInitialPage({policyDraft, policy: policyProp, route}: Workspac
>
<HeaderWithBackButton
title={policyName}
onBackButtonPress={() => {
if (route.params?.backTo) {
Navigation.goBack(ROUTES.HOME);
Navigation.isNavigationReady().then(() => Navigation.navigate(route.params?.backTo as Route));
} else {
Navigation.goBack(ROUTES.SETTINGS_WORKSPACES);
}
}}
onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)}
policyAvatar={policyAvatar}
style={styles.headerBarDesktopHeight}
/>
Expand Down

0 comments on commit 2e08e1e

Please sign in to comment.