diff --git a/src/pages/workspace/WorkspacePageWithSections.tsx b/src/pages/workspace/WorkspacePageWithSections.tsx index f7ab94c5ff81..27a27766136a 100644 --- a/src/pages/workspace/WorkspacePageWithSections.tsx +++ b/src/pages/workspace/WorkspacePageWithSections.tsx @@ -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'; @@ -89,6 +89,7 @@ function WorkspacePageWithSections({ guidesCallTaskID = '', headerText, policy, + policyDraft, reimbursementAccount = ReimbursementAccountProps.reimbursementAccountDefaultProps, route, shouldUseScrollView = false, @@ -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 (