From 511c9ad23a8410402c17caedc085d6c8e67c756b Mon Sep 17 00:00:00 2001 From: dominictb Date: Mon, 16 Sep 2024 02:26:27 +0700 Subject: [PATCH 1/6] fix: app goes to workspace initial page when back from not found page --- .../CustomFullScreenRouter.tsx | 21 ++++++++++++++++--- src/libs/Navigation/Navigation.ts | 14 +++++++++++++ src/libs/PolicyUtils.ts | 5 +++++ .../workspace/AccessOrNotFoundWrapper.tsx | 10 ++++++++- 4 files changed, 46 insertions(+), 4 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx b/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx index 27e976d9be0c..3980be047d97 100644 --- a/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx +++ b/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx @@ -1,6 +1,10 @@ import type {ParamListBase, PartialState, RouterConfigOptions, StackNavigationState} from '@react-navigation/native'; import {StackRouter} from '@react-navigation/native'; +import {useOnyx} from 'react-native-onyx'; +import type {OnyxEntry} from 'react-native-onyx'; import getIsNarrowLayout from '@libs/getIsNarrowLayout'; +import * as PolicyUtils from '@libs/PolicyUtils'; +import ONYXKEYS from '@src/ONYXKEYS'; import SCREENS from '@src/SCREENS'; import type {FullScreenNavigatorRouterOptions} from './types'; @@ -8,12 +12,22 @@ type StackState = StackNavigationState | PartialState state.routes.some((route) => route.name === screenName); -function adaptStateIfNecessary(state: StackState) { +function adaptStateIfNecessary(state: StackState, isLoadingReportData: OnyxEntry) { const isNarrowLayout = getIsNarrowLayout(); const workspaceCentralPane = state.routes.at(-1); + const policyID = + workspaceCentralPane?.params && 'policyID' in workspaceCentralPane.params && typeof workspaceCentralPane.params.policyID === 'string' + ? workspaceCentralPane.params.policyID + : undefined; // There should always be WORKSPACE.INITIAL screen in the state to make sure go back works properly if we deeplinkg to a subpage of settings. if (!isAtLeastOneInState(state, SCREENS.WORKSPACE.INITIAL)) { + const policy = PolicyUtils.getPolicy(policyID ?? ''); + const isPolicyAccessible = PolicyUtils.isPolicyAccessible(policy); + if (isLoadingReportData && !isPolicyAccessible) { + return; + } + // @ts-expect-error Updating read only property // noinspection JSConstantReassignment state.stale = true; // eslint-disable-line @@ -51,12 +65,13 @@ function adaptStateIfNecessary(state: StackState) { function CustomFullScreenRouter(options: FullScreenNavigatorRouterOptions) { const stackRouter = StackRouter(options); + const [isLoadingReportData] = useOnyx(ONYXKEYS.IS_LOADING_REPORT_DATA, {initialValue: true}); return { ...stackRouter, getInitialState({routeNames, routeParamList, routeGetIdList}: RouterConfigOptions) { const initialState = stackRouter.getInitialState({routeNames, routeParamList, routeGetIdList}); - adaptStateIfNecessary(initialState); + adaptStateIfNecessary(initialState, isLoadingReportData); // If we needed to modify the state we need to rehydrate it to get keys for new routes. if (initialState.stale) { @@ -66,7 +81,7 @@ function CustomFullScreenRouter(options: FullScreenNavigatorRouterOptions) { return initialState; }, getRehydratedState(partialState: StackState, {routeNames, routeParamList, routeGetIdList}: RouterConfigOptions): StackNavigationState { - adaptStateIfNecessary(partialState); + adaptStateIfNecessary(partialState, isLoadingReportData); const state = stackRouter.getRehydratedState(partialState, {routeNames, routeParamList, routeGetIdList}); return state; }, diff --git a/src/libs/Navigation/Navigation.ts b/src/libs/Navigation/Navigation.ts index 4c61b953f572..67abfb53a9c3 100644 --- a/src/libs/Navigation/Navigation.ts +++ b/src/libs/Navigation/Navigation.ts @@ -12,6 +12,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type {HybridAppRoute, Route} from '@src/ROUTES'; import ROUTES, {HYBRID_APP_ROUTES} from '@src/ROUTES'; import {PROTECTED_SCREENS} from '@src/SCREENS'; +import type {Screen} from '@src/SCREENS'; import type {Report} from '@src/types/onyx'; import originalCloseRHPFlow from './closeRHPFlow'; import originalDismissModal from './dismissModal'; @@ -410,6 +411,18 @@ function getTopMostCentralPaneRouteFromRootState() { return getTopmostCentralPaneRoute(navigationRef.getRootState() as State); } +function removeScreenFromNavigationState(screen: Screen) { + navigationRef.dispatch((state) => { + const routes = state.routes?.filter((item) => item.name !== screen); + + return CommonActions.reset({ + ...state, + routes, + index: routes.length < state.routes.length ? state.index - 1 : state.index, + }); + }); +} + export default { setShouldPopAllStateOnUP, navigate, @@ -433,6 +446,7 @@ export default { closeRHPFlow, setNavigationActionToMicrotaskQueue, getTopMostCentralPaneRouteFromRootState, + removeScreenFromNavigationState, }; export {navigationRef}; diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index b98188567178..28f9989a3e51 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -996,6 +996,10 @@ function getWorkflowApprovalsUnavailable(policy: OnyxEntry) { return policy?.approvalMode === CONST.POLICY.APPROVAL_MODE.OPTIONAL || !!policy?.errorFields?.approvalMode; } +function isPolicyAccessible(policy: OnyxEntry) { + return !isEmptyObject(policy) && (Object.keys(policy).length !== 1 || isEmptyObject(policy.errors)) && policy?.id; +} + export { canEditTaxRate, extractPolicyIDFromPath, @@ -1105,6 +1109,7 @@ export { getTagNamesFromTagsLists, getDomainNameForPolicy, getWorkflowApprovalsUnavailable, + isPolicyAccessible, }; export type {MemberEmailsToAccountIDs}; diff --git a/src/pages/workspace/AccessOrNotFoundWrapper.tsx b/src/pages/workspace/AccessOrNotFoundWrapper.tsx index 1a6f59830506..aa859f744f34 100644 --- a/src/pages/workspace/AccessOrNotFoundWrapper.tsx +++ b/src/pages/workspace/AccessOrNotFoundWrapper.tsx @@ -16,6 +16,7 @@ import type {IOUType} from '@src/CONST'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; +import SCREENS from '@src/SCREENS'; import type * as OnyxTypes from '@src/types/onyx'; import type {PolicyFeatureName} from '@src/types/onyx/Policy'; import callOrReturn from '@src/types/utils/callOrReturn'; @@ -132,7 +133,7 @@ function AccessOrNotFoundWrapper({accessVariants = [], fullPageNotFoundViewProps return acc && accessFunction(policy, login, report, allPolicies ?? null, iouType); }, true); - const isPolicyNotAccessible = isEmptyObject(policy) || (Object.keys(policy).length === 1 && !isEmptyObject(policy.errors)) || !policy?.id; + const isPolicyNotAccessible = !PolicyUtils.isPolicyAccessible(policy); const shouldShowNotFoundPage = (!isMoneyRequest && !isFromGlobalCreate && isPolicyNotAccessible) || !isPageAccessible || !isPolicyFeatureEnabled || shouldBeBlocked; // We only update the feature state if it isn't pending. @@ -145,6 +146,13 @@ function AccessOrNotFoundWrapper({accessVariants = [], fullPageNotFoundViewProps setIsPolicyFeatureEnabled(isFeatureEnabled); }, [pendingField, isOffline, isFeatureEnabled]); + useEffect(() => { + if (!isPolicyNotAccessible) { + return; + } + Navigation.removeScreenFromNavigationState(SCREENS.WORKSPACE.INITIAL); + }, [isPolicyNotAccessible]); + if (shouldShowFullScreenLoadingIndicator) { return ; } From 1df33b40e247ee4f175d88a26ce1185172148b55 Mon Sep 17 00:00:00 2001 From: dominictb Date: Mon, 16 Sep 2024 02:44:26 +0700 Subject: [PATCH 2/6] modify add route condition --- .../createCustomFullScreenNavigator/CustomFullScreenRouter.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx b/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx index 3980be047d97..ee6c2179c4b4 100644 --- a/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx +++ b/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx @@ -24,7 +24,7 @@ function adaptStateIfNecessary(state: StackState, isLoadingReportData: OnyxEntry if (!isAtLeastOneInState(state, SCREENS.WORKSPACE.INITIAL)) { const policy = PolicyUtils.getPolicy(policyID ?? ''); const isPolicyAccessible = PolicyUtils.isPolicyAccessible(policy); - if (isLoadingReportData && !isPolicyAccessible) { + if (!isLoadingReportData && !isPolicyAccessible) { return; } From e43dcd15903ed4d3da9d7ecfb806aace4e0b81b6 Mon Sep 17 00:00:00 2001 From: dominictb Date: Tue, 24 Sep 2024 15:19:25 +0700 Subject: [PATCH 3/6] fix: add comment --- .../createCustomFullScreenNavigator/CustomFullScreenRouter.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx b/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx index ee6c2179c4b4..0994a25efea5 100644 --- a/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx +++ b/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx @@ -21,6 +21,7 @@ function adaptStateIfNecessary(state: StackState, isLoadingReportData: OnyxEntry : undefined; // There should always be WORKSPACE.INITIAL screen in the state to make sure go back works properly if we deeplinkg to a subpage of settings. + // The only exception is when the workspace is invalid or inaccessible. if (!isAtLeastOneInState(state, SCREENS.WORKSPACE.INITIAL)) { const policy = PolicyUtils.getPolicy(policyID ?? ''); const isPolicyAccessible = PolicyUtils.isPolicyAccessible(policy); From 09e9fb1144ed14b41f14d77a766e055ff21bc8cb Mon Sep 17 00:00:00 2001 From: dominictb Date: Fri, 11 Oct 2024 14:56:11 +0700 Subject: [PATCH 4/6] do not use hook to get isLoadingReportData --- .../CustomFullScreenRouter.tsx | 12 ++++-------- src/libs/PolicyUtils.ts | 9 ++++++++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx b/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx index e6c190d4002b..e09de8fce287 100644 --- a/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx +++ b/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx @@ -1,10 +1,7 @@ import type {ParamListBase, PartialState, RouterConfigOptions, StackNavigationState} from '@react-navigation/native'; import {StackRouter} from '@react-navigation/native'; -import {useOnyx} from 'react-native-onyx'; -import type {OnyxEntry} from 'react-native-onyx'; import getIsNarrowLayout from '@libs/getIsNarrowLayout'; import * as PolicyUtils from '@libs/PolicyUtils'; -import ONYXKEYS from '@src/ONYXKEYS'; import SCREENS from '@src/SCREENS'; import type {FullScreenNavigatorRouterOptions} from './types'; @@ -12,7 +9,7 @@ type StackState = StackNavigationState | PartialState state.routes.some((route) => route.name === screenName); -function adaptStateIfNecessary(state: StackState, isLoadingReportData: OnyxEntry) { +function adaptStateIfNecessary(state: StackState) { const isNarrowLayout = getIsNarrowLayout(); const workspaceCentralPane = state.routes.at(-1); const policyID = @@ -25,7 +22,7 @@ function adaptStateIfNecessary(state: StackState, isLoadingReportData: OnyxEntry if (!isAtLeastOneInState(state, SCREENS.WORKSPACE.INITIAL)) { const policy = PolicyUtils.getPolicy(policyID ?? ''); const isPolicyAccessible = PolicyUtils.isPolicyAccessible(policy); - if (!isLoadingReportData && !isPolicyAccessible) { + if (!isPolicyAccessible) { return; } @@ -66,13 +63,12 @@ function adaptStateIfNecessary(state: StackState, isLoadingReportData: OnyxEntry function CustomFullScreenRouter(options: FullScreenNavigatorRouterOptions) { const stackRouter = StackRouter(options); - const [isLoadingReportData] = useOnyx(ONYXKEYS.IS_LOADING_REPORT_DATA, {initialValue: true}); return { ...stackRouter, getInitialState({routeNames, routeParamList, routeGetIdList}: RouterConfigOptions) { const initialState = stackRouter.getInitialState({routeNames, routeParamList, routeGetIdList}); - adaptStateIfNecessary(initialState, isLoadingReportData); + adaptStateIfNecessary(initialState); // If we needed to modify the state we need to rehydrate it to get keys for new routes. if (initialState.stale) { @@ -82,7 +78,7 @@ function CustomFullScreenRouter(options: FullScreenNavigatorRouterOptions) { return initialState; }, getRehydratedState(partialState: StackState, {routeNames, routeParamList, routeGetIdList}: RouterConfigOptions): StackNavigationState { - adaptStateIfNecessary(partialState, isLoadingReportData); + adaptStateIfNecessary(partialState); const state = stackRouter.getRehydratedState(partialState, {routeNames, routeParamList, routeGetIdList}); return state; }, diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index 24287e5b265e..b8ccf21616b4 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -55,6 +55,13 @@ Onyx.connect({ callback: (value) => (allPolicies = value), }); +let isLoadingReportData = true; +Onyx.connect({ + key: ONYXKEYS.IS_LOADING_REPORT_DATA, + initWithStoredValues: false, + callback: (value) => (isLoadingReportData = value ?? false), +}); + /** * Filter out the active policies, which will exclude policies with pending deletion * These are policies that we can use to create reports with in NewDot. @@ -1041,7 +1048,7 @@ function getWorkflowApprovalsUnavailable(policy: OnyxEntry) { } function isPolicyAccessible(policy: OnyxEntry) { - return !isEmptyObject(policy) && (Object.keys(policy).length !== 1 || isEmptyObject(policy.errors)) && policy?.id; + return !isLoadingReportData && !isEmptyObject(policy) && (Object.keys(policy).length !== 1 || isEmptyObject(policy.errors)) && policy?.id; } export { From 0386167ba59ed536c841eaea1c369caef00dd3e1 Mon Sep 17 00:00:00 2001 From: dominictb Date: Tue, 22 Oct 2024 14:27:43 +0700 Subject: [PATCH 5/6] fix: initial workspace is removed in 3-pane layout --- .../CustomFullScreenRouter.tsx | 8 ++++---- src/libs/PolicyUtils.ts | 9 +++++++-- src/pages/workspace/AccessOrNotFoundWrapper.tsx | 4 ++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx b/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx index e09de8fce287..fa4b22c4ac98 100644 --- a/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx +++ b/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx @@ -16,16 +16,16 @@ function adaptStateIfNecessary(state: StackState) { workspaceCentralPane?.params && 'policyID' in workspaceCentralPane.params && typeof workspaceCentralPane.params.policyID === 'string' ? workspaceCentralPane.params.policyID : undefined; + const policy = PolicyUtils.getPolicy(policyID ?? ''); + const isLoadingReportData = PolicyUtils.getIsLoadingReportData(); + const isPolicyAccessible = PolicyUtils.isPolicyAccessible(policy); // There should always be WORKSPACE.INITIAL screen in the state to make sure go back works properly if we deeplinkg to a subpage of settings. // The only exception is when the workspace is invalid or inaccessible. if (!isAtLeastOneInState(state, SCREENS.WORKSPACE.INITIAL)) { - const policy = PolicyUtils.getPolicy(policyID ?? ''); - const isPolicyAccessible = PolicyUtils.isPolicyAccessible(policy); - if (!isPolicyAccessible) { + if (isNarrowLayout && !isLoadingReportData && !isPolicyAccessible) { return; } - // @ts-expect-error Updating read only property // noinspection JSConstantReassignment state.stale = true; // eslint-disable-line diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index 2ca572395aca..707a8387e103 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -1071,8 +1071,12 @@ function getActivePolicy(): OnyxEntry { return getPolicy(activePolicyId); } -function isPolicyAccessible(policy: OnyxEntry) { - return !isLoadingReportData && !isEmptyObject(policy) && (Object.keys(policy).length !== 1 || isEmptyObject(policy.errors)) && policy?.id; +function isPolicyAccessible(policy: OnyxEntry): boolean { + return !isEmptyObject(policy) && (Object.keys(policy).length !== 1 || isEmptyObject(policy.errors)) && !!policy?.id; +} + +function getIsLoadingReportData() { + return isLoadingReportData; } export { @@ -1193,6 +1197,7 @@ export { getAllPoliciesLength, getActivePolicy, isPolicyAccessible, + getIsLoadingReportData, }; export type {MemberEmailsToAccountIDs}; diff --git a/src/pages/workspace/AccessOrNotFoundWrapper.tsx b/src/pages/workspace/AccessOrNotFoundWrapper.tsx index 952378f4ce14..452bf27e6570 100644 --- a/src/pages/workspace/AccessOrNotFoundWrapper.tsx +++ b/src/pages/workspace/AccessOrNotFoundWrapper.tsx @@ -165,11 +165,11 @@ function AccessOrNotFoundWrapper({ const childrenProps = useMemo(() => ({report, policy, isLoadingReportData}), [report, policy, isLoadingReportData]); useEffect(() => { - if (!isPolicyNotAccessible) { + if (isLoadingReportData || !isPolicyNotAccessible) { return; } Navigation.removeScreenFromNavigationState(SCREENS.WORKSPACE.INITIAL); - }, [isPolicyNotAccessible]); + }, [isLoadingReportData, isPolicyNotAccessible]); if (shouldShowFullScreenLoadingIndicator) { return ; From 63029f1e2727d6809a8f69a3f36a2b2f4d2de2f5 Mon Sep 17 00:00:00 2001 From: dominictb Date: Tue, 29 Oct 2024 16:28:42 +0700 Subject: [PATCH 6/6] fix: stale isLoadingReportData Onyx value --- .../CustomFullScreenRouter.tsx | 10 +++++++++- src/libs/Navigation/Navigation.ts | 16 +++++++++------- src/libs/PolicyUtils.ts | 12 ------------ src/pages/workspace/AccessOrNotFoundWrapper.tsx | 1 + 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx b/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx index fa4b22c4ac98..a5746f6f8e81 100644 --- a/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx +++ b/src/libs/Navigation/AppNavigator/createCustomFullScreenNavigator/CustomFullScreenRouter.tsx @@ -1,7 +1,9 @@ import type {ParamListBase, PartialState, RouterConfigOptions, StackNavigationState} from '@react-navigation/native'; import {StackRouter} from '@react-navigation/native'; +import Onyx from 'react-native-onyx'; import getIsNarrowLayout from '@libs/getIsNarrowLayout'; import * as PolicyUtils from '@libs/PolicyUtils'; +import ONYXKEYS from '@src/ONYXKEYS'; import SCREENS from '@src/SCREENS'; import type {FullScreenNavigatorRouterOptions} from './types'; @@ -9,6 +11,13 @@ type StackState = StackNavigationState | PartialState state.routes.some((route) => route.name === screenName); +let isLoadingReportData = true; +Onyx.connect({ + key: ONYXKEYS.IS_LOADING_REPORT_DATA, + initWithStoredValues: false, + callback: (value) => (isLoadingReportData = value ?? false), +}); + function adaptStateIfNecessary(state: StackState) { const isNarrowLayout = getIsNarrowLayout(); const workspaceCentralPane = state.routes.at(-1); @@ -17,7 +26,6 @@ function adaptStateIfNecessary(state: StackState) { ? workspaceCentralPane.params.policyID : undefined; const policy = PolicyUtils.getPolicy(policyID ?? ''); - const isLoadingReportData = PolicyUtils.getIsLoadingReportData(); const isPolicyAccessible = PolicyUtils.isPolicyAccessible(policy); // There should always be WORKSPACE.INITIAL screen in the state to make sure go back works properly if we deeplinkg to a subpage of settings. diff --git a/src/libs/Navigation/Navigation.ts b/src/libs/Navigation/Navigation.ts index 4786f60c273a..d54668bf3f69 100644 --- a/src/libs/Navigation/Navigation.ts +++ b/src/libs/Navigation/Navigation.ts @@ -420,13 +420,15 @@ function getTopMostCentralPaneRouteFromRootState() { } function removeScreenFromNavigationState(screen: Screen) { - navigationRef.dispatch((state) => { - const routes = state.routes?.filter((item) => item.name !== screen); - - return CommonActions.reset({ - ...state, - routes, - index: routes.length < state.routes.length ? state.index - 1 : state.index, + isNavigationReady().then(() => { + navigationRef.dispatch((state) => { + const routes = state.routes?.filter((item) => item.name !== screen); + + return CommonActions.reset({ + ...state, + routes, + index: routes.length < state.routes.length ? state.index - 1 : state.index, + }); }); }); } diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index 5d142f87ec3a..7c5b24b4827b 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -62,13 +62,6 @@ Onyx.connect({ callback: (value) => (activePolicyId = value), }); -let isLoadingReportData = true; -Onyx.connect({ - key: ONYXKEYS.IS_LOADING_REPORT_DATA, - initWithStoredValues: false, - callback: (value) => (isLoadingReportData = value ?? false), -}); - /** * Filter out the active policies, which will exclude policies with pending deletion * These are policies that we can use to create reports with in NewDot. @@ -1075,10 +1068,6 @@ function isPolicyAccessible(policy: OnyxEntry): boolean { return !isEmptyObject(policy) && (Object.keys(policy).length !== 1 || isEmptyObject(policy.errors)) && !!policy?.id; } -function getIsLoadingReportData() { - return isLoadingReportData; -} - export { canEditTaxRate, extractPolicyIDFromPath, @@ -1197,7 +1186,6 @@ export { getAllPoliciesLength, getActivePolicy, isPolicyAccessible, - getIsLoadingReportData, }; export type {MemberEmailsToAccountIDs}; diff --git a/src/pages/workspace/AccessOrNotFoundWrapper.tsx b/src/pages/workspace/AccessOrNotFoundWrapper.tsx index 09f8ed32d86f..9bda7f3972f9 100644 --- a/src/pages/workspace/AccessOrNotFoundWrapper.tsx +++ b/src/pages/workspace/AccessOrNotFoundWrapper.tsx @@ -167,6 +167,7 @@ function AccessOrNotFoundWrapper({ }, [pendingField, isOffline, isFeatureEnabled]); useEffect(() => { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if (isLoadingReportData || !isPolicyNotAccessible) { return; }