Skip to content

Commit

Permalink
Revert "fix: nconsistent Navigation After Creating Workspace"
Browse files Browse the repository at this point in the history
This reverts commit 672ac2d.
  • Loading branch information
nkdengineer committed Aug 7, 2024
1 parent 672ac2d commit cb5e022
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ const ROUTES = {
WORKSPACE_NEW_ROOM: 'workspace/new-room',
WORKSPACE_INITIAL: {
route: 'settings/workspaces/:policyID',
getRoute: (policyID: string, backTo?: string) => `${getUrlWithBackToParam(`settings/workspaces/${policyID}`, backTo)}` as const,
getRoute: (policyID: string) => `settings/workspaces/${policyID}` as const,
},
WORKSPACE_INVITE: {
route: 'settings/workspaces/:policyID/invite',
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 @@ -1102,7 +1102,6 @@ type TravelNavigatorParamList = {
type FullScreenNavigatorParamList = {
[SCREENS.WORKSPACE.INITIAL]: {
policyID: string;
backTo?: string;
};
[SCREENS.WORKSPACE.PROFILE]: {
policyID: string;
Expand Down
4 changes: 2 additions & 2 deletions src/libs/actions/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ function endSignOnTransition() {
* @param [transitionFromOldDot] Optional, if the user is transitioning from old dot
* @param [makeMeAdmin] Optional, leave the calling account as an admin on the policy
*/
function createWorkspaceWithPolicyDraftAndNavigateToIt(policyOwnerEmail = '', policyName = '', transitionFromOldDot = false, makeMeAdmin = false, backTo = '') {
function createWorkspaceWithPolicyDraftAndNavigateToIt(policyOwnerEmail = '', policyName = '', transitionFromOldDot = false, makeMeAdmin = false) {
const policyID = Policy.generatePolicyID();
Policy.createDraftInitialWorkspace(policyOwnerEmail, policyName, policyID, makeMeAdmin);

Expand All @@ -361,7 +361,7 @@ function createWorkspaceWithPolicyDraftAndNavigateToIt(policyOwnerEmail = '', po
// We must call goBack() to remove the /transition route from history
Navigation.goBack();
}
Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(policyID, backTo));
Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(policyID));
})
.then(endSignOnTransition);
}
Expand Down
4 changes: 1 addition & 3 deletions src/pages/WorkspaceSwitcherPage/WorkspacesSectionHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import useLocalize from '@hooks/useLocalize';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import interceptAnonymousUser from '@libs/interceptAnonymousUser';
import Navigation from '@libs/Navigation/Navigation';
import * as App from '@userActions/App';
import CONST from '@src/CONST';

Expand All @@ -33,8 +32,7 @@ function WorkspacesSectionHeader() {
accessible={false}
role={CONST.ROLE.BUTTON}
onPress={() => {
const activeRoute = Navigation.getActiveRouteWithoutParams();
interceptAnonymousUser(() => App.createWorkspaceWithPolicyDraftAndNavigateToIt('', '', false, false, activeRoute));
interceptAnonymousUser(() => App.createWorkspaceWithPolicyDraftAndNavigateToIt());
}}
>
{({hovered}) => (
Expand Down
10 changes: 1 addition & 9 deletions src/pages/workspace/WorkspaceInitialPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import * as ReimbursementAccount from '@userActions/ReimbursementAccount';
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
import ONYXKEYS from '@src/ONYXKEYS';
import type {Route} from '@src/ROUTES';
import ROUTES from '@src/ROUTES';
import SCREENS from '@src/SCREENS';
import type * as OnyxTypes from '@src/types/onyx';
Expand Down Expand Up @@ -394,14 +393,7 @@ function WorkspaceInitialPage({policyDraft, policy: policyProp, reimbursementAcc
>
<HeaderWithBackButton
title={policyName}
onBackButtonPress={() => {
if (route.params?.backTo) {
Navigation.resetToHome();
Navigation.navigate(route.params?.backTo as Route);
} else {
Navigation.dismissModal();
}
}}
onBackButtonPress={Navigation.dismissModal}
policyAvatar={policyAvatar}
style={styles.headerBarDesktopHeight}
/>
Expand Down

0 comments on commit cb5e022

Please sign in to comment.