Skip to content

Commit

Permalink
Merge pull request #54 from software-mansion-labs/w8/ideal-nav-fixes-v4
Browse files Browse the repository at this point in the history
W8/ideal nav fixes v4
  • Loading branch information
kosmydel authored Jan 31, 2024
2 parents a1142bc + 496059e commit b60bc80
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 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 @@ -89,6 +89,7 @@ function WorkspacePageWithSections({
guidesCallTaskID = '',
headerText,
policy,
policyDraft,
reimbursementAccount = ReimbursementAccountProps.reimbursementAccountDefaultProps,
route,
shouldUseScrollView = false,
Expand Down Expand Up @@ -128,12 +129,13 @@ function WorkspacePageWithSections({
}, [shouldSkipVBBACall]);

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

return (!PolicyUtils.isPolicyAdmin(policy) && !shouldShowNonAdmin) || PolicyUtils.isPendingDeletePolicy(policy);
}, [shouldShowNonAdmin, policy]);
return (!isEmptyObject(policy) && !PolicyUtils.isPolicyAdmin(policy) && !shouldShowNonAdmin) || PolicyUtils.isPendingDeletePolicy(policy);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [policy, shouldShowNonAdmin]);

return (
<ScreenWrapper
Expand Down

0 comments on commit b60bc80

Please sign in to comment.