Skip to content

Commit

Permalink
Merge pull request Expensify#40276 from tienifr/fix/38922
Browse files Browse the repository at this point in the history
fix Unsynchronized transition of left and right page when deleting workspace
  • Loading branch information
dangrous authored Apr 19, 2024
2 parents 0ab574b + e0e1eba commit 4654d6e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/pages/workspace/WorkspaceInitialPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,13 @@ function WorkspaceInitialPage({policyDraft, policy: policyProp, reimbursementAcc
// We check isPendingDelete for both policy and prevPolicy to prevent the NotFound view from showing right after we delete the workspace
(PolicyUtils.isPendingDeletePolicy(policy) && PolicyUtils.isPendingDeletePolicy(prevPolicy));

useEffect(() => {
if (isEmptyObject(prevPolicy) || PolicyUtils.isPendingDeletePolicy(prevPolicy) || !PolicyUtils.isPendingDeletePolicy(policy)) {
return;
}
PolicyUtils.goBackFromInvalidPolicy();
}, [policy, prevPolicy]);

const policyAvatar = useMemo(() => {
if (!policy) {
return {source: Expensicons.ExpensifyAppIcon, name: CONST.WORKSPACE_SWITCHER.NAME, type: CONST.ICON_TYPE_AVATAR};
Expand Down Expand Up @@ -299,6 +306,8 @@ function WorkspaceInitialPage({policyDraft, policy: policyProp, reimbursementAcc
onClose={() => dismissError(policyID)}
errors={policy?.errors}
errorRowStyles={[styles.ph5, styles.pv2]}
shouldDisableStrikeThrough={false}
shouldHideOnDelete={false}
>
<View style={[styles.pb4, styles.mh3, styles.mt3]}>
{/*
Expand Down
1 change: 0 additions & 1 deletion src/pages/workspace/WorkspaceProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ function WorkspaceProfilePage({policy, currencyList = {}, route}: WorkSpaceProfi
}

Policy.deleteWorkspace(policy?.id, policyName);
PolicyUtils.goBackFromInvalidPolicy();
setIsDeleteModalOpen(false);

// If the workspace being deleted is the active workspace, switch to the "All Workspaces" view
Expand Down

0 comments on commit 4654d6e

Please sign in to comment.