Skip to content

Commit

Permalink
Merge pull request #44524 from bernhardoj/fix/43436-error-page-openin…
Browse files Browse the repository at this point in the history
…g-ws-join-link

Fix not found page shown when navigate to Workspace Join link after leaving the workspace
  • Loading branch information
AndrewGable authored Jun 27, 2024
2 parents 5ee9922 + 4746775 commit 3519795
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
7 changes: 1 addition & 6 deletions src/libs/actions/Policy/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -606,12 +606,7 @@ function leaveWorkspace(policyID: string) {
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
value: {
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE,
employeeList: {
[sessionEmail]: null,
},
},
value: null,
},
];
const failureData: OnyxUpdate[] = [
Expand Down
3 changes: 2 additions & 1 deletion src/pages/workspace/WorkspaceJoinUserPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator';
import ScreenWrapper from '@components/ScreenWrapper';
import useThemeStyles from '@hooks/useThemeStyles';
import navigateAfterJoinRequest from '@libs/navigateAfterJoinRequest';
import * as PolicyUtils from '@libs/PolicyUtils';
import Navigation from '@navigation/Navigation';
import type {AuthScreensParamList} from '@navigation/types';
import * as MemberAction from '@userActions/Policy/Member';
Expand Down Expand Up @@ -42,7 +43,7 @@ function WorkspaceJoinUserPage({route, policy}: WorkspaceJoinUserPageProps) {
if (isUnmounted.current || isJoinLinkUsed) {
return;
}
if (!isEmptyObject(policy) && !policy?.isJoinRequestPending) {
if (!isEmptyObject(policy) && !policy?.isJoinRequestPending && !PolicyUtils.isPendingDeletePolicy(policy)) {
Navigation.isNavigationReady().then(() => {
Navigation.goBack(undefined, false, true);
Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(policyID ?? '-1'));
Expand Down

0 comments on commit 3519795

Please sign in to comment.