Skip to content

Commit

Permalink
Merge pull request #43651 from bernhardoj/fix/43143-empty-screen-tran…
Browse files Browse the repository at this point in the history
…sfer-owner

Fix empty screen when transferring ownership of the workplace
  • Loading branch information
madmax330 authored Jun 14, 2024
2 parents 2144fc6 + 7ad6165 commit 43cd0f7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
5 changes: 4 additions & 1 deletion src/libs/Navigation/linkTo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ export default function linkTo(navigation: NavigationContainerRef<RootStackParam
const targetFocusedRoute = findFocusedRoute(stateFromPath);

// If the current focused route is the same as the target focused route, we don't want to navigate.
if (currentFocusedRoute?.name === targetFocusedRoute?.name) {
if (
currentFocusedRoute?.name === targetFocusedRoute?.name &&
shallowCompare(currentFocusedRoute?.params as Record<string, string | undefined>, targetFocusedRoute?.params as Record<string, string | undefined>)
) {
return;
}

Expand Down
12 changes: 0 additions & 12 deletions src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,6 @@ function WorkspaceMemberDetailsPage({personalDetails, policy, route}: WorkspaceM
[member?.role, translate],
);

useEffect(() => {
if (!policy?.errorFields?.changeOwner && policy?.isChangeOwnerSuccessful) {
return;
}

const changeOwnerErrors = Object.keys(policy?.errorFields?.changeOwner ?? {});

if (changeOwnerErrors && changeOwnerErrors.length > 0) {
Navigation.navigate(ROUTES.WORKSPACE_OWNER_CHANGE_CHECK.getRoute(policyID, accountID, changeOwnerErrors[0] as ValueOf<typeof CONST.POLICY.OWNERSHIP_ERRORS>));
}
}, [accountID, policy?.errorFields?.changeOwner, policy?.isChangeOwnerSuccessful, policyID]);

useEffect(() => {
if (!prevMember || prevMember?.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || member?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function WorkspaceOwnerChangeWrapperPage({route, policy}: WorkspaceOwnerChangeWr

const changeOwnerErrors = Object.keys(policy?.errorFields?.changeOwner ?? {});

if (changeOwnerErrors && changeOwnerErrors.length > 0 && changeOwnerErrors[0] !== CONST.POLICY.OWNERSHIP_ERRORS.NO_BILLING_CARD) {
if (changeOwnerErrors && changeOwnerErrors.length > 0) {
Navigation.navigate(ROUTES.WORKSPACE_OWNER_CHANGE_CHECK.getRoute(policyID, accountID, changeOwnerErrors[0] as ValueOf<typeof CONST.POLICY.OWNERSHIP_ERRORS>));
}
}, [accountID, policy, policy?.errorFields?.changeOwner, policyID]);
Expand Down

0 comments on commit 43cd0f7

Please sign in to comment.