Skip to content

Commit

Permalink
Fix showing not-found when the new workspace is created (215)
Browse files Browse the repository at this point in the history
  • Loading branch information
WojtekBoman committed Jan 31, 2024
1 parent 92ceb2a commit 1424356
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/pages/workspace/WorkspacePageWithSections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import type {RouteProp} from '@react-navigation/native';
import type {ReactNode} from 'react';
import React, {useEffect, useMemo, useRef} from 'react';
import {View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
import {withOnyx} from 'react-native-onyx';
import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView';
import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
Expand Down Expand Up @@ -83,6 +83,7 @@ function WorkspacePageWithSections({
guidesCallTaskID = '',
headerText,
policy,
policyDraft,
reimbursementAccount = ReimbursementAccountProps.reimbursementAccountDefaultProps,
route,
shouldUseScrollView = false,
Expand All @@ -95,7 +96,6 @@ function WorkspacePageWithSections({
useNetwork({onReconnect: () => fetchData(shouldSkipVBBACall)});

const isLoading = reimbursementAccount?.isLoading ?? true;
const isOverview = route.name;
const achState = reimbursementAccount?.achData?.state ?? '';
const isUsingECard = user?.isUsingExpensifyCard ?? false;
const policyID = route.params.policyID;
Expand All @@ -121,13 +121,13 @@ function WorkspacePageWithSections({
}, [shouldSkipVBBACall]);

const shouldShow = useMemo(() => {
if (isEmptyObject(policy)) {
if (isEmptyObject(policy) && isEmptyObject(policyDraft)) {
return true;
}

// TODO - check is the value of isOveriew is correct
return !PolicyUtils.isPolicyAdmin(policy) || PolicyUtils.isPendingDeletePolicy(policy) || !isOverview;
}, [isOverview, policy]);
return (!isEmptyObject(policy) && !PolicyUtils.isPolicyAdmin(policy)) || PolicyUtils.isPendingDeletePolicy(policy);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [policy]);

return (
<ScreenWrapper
Expand Down

0 comments on commit 1424356

Please sign in to comment.