diff --git a/src/libs/actions/PolicyConnections.ts b/src/libs/actions/PolicyConnections.ts index 7ccf9f2506bd..4ea65a79352b 100644 --- a/src/libs/actions/PolicyConnections.ts +++ b/src/libs/actions/PolicyConnections.ts @@ -15,13 +15,20 @@ function openPolicyAccountingPage(policyID: string) { value: false, }, ]; - const finallyData: OnyxUpdate[] = [ + const successData: OnyxUpdate[] = [ { onyxMethod: Onyx.METHOD.MERGE, key: hasConnectionsDataBeenFetchedKey, value: true, }, ]; + const failureData: OnyxUpdate[] = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: hasConnectionsDataBeenFetchedKey, + value: false, + }, + ]; const parameters: OpenPolicyAccountingPageParams = { policyID, @@ -29,7 +36,8 @@ function openPolicyAccountingPage(policyID: string) { API.read(READ_COMMANDS.OPEN_POLICY_ACCOUNTING_PAGE, parameters, { optimisticData, - finallyData, + successData, + failureData, }); } diff --git a/src/pages/workspace/withPolicyConnections.tsx b/src/pages/workspace/withPolicyConnections.tsx index b5d3ffc87a59..c2dbaceafa7e 100644 --- a/src/pages/workspace/withPolicyConnections.tsx +++ b/src/pages/workspace/withPolicyConnections.tsx @@ -3,6 +3,7 @@ import type {ComponentType} from 'react'; import {useOnyx} from 'react-native-onyx'; import FullPageOfflineBlockingView from '@components/BlockingViews/FullPageOfflineBlockingView'; import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; +import useNetwork from '@hooks/useNetwork'; import {openPolicyAccountingPage} from '@libs/actions/PolicyConnections'; import ONYXKEYS from '@src/ONYXKEYS'; import type {Policy} from '@src/types/onyx'; @@ -23,6 +24,7 @@ type WithPolicyConnectionsProps = WithPolicyProps; */ function withPolicyConnections(WrappedComponent: ComponentType) { function WithPolicyConnections({policy, policyDraft, route}: WithPolicyConnectionsProps) { + const {isOffline} = useNetwork(); const [hasConnectionsDataBeenFetched, {status}] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_HAS_CONNECTIONS_DATA_BEEN_FETCHED}${policy?.id ?? '0'}`, { initWithStoredValues: false, }); @@ -35,7 +37,7 @@ function withPolicyConnections(WrappedComponent: ComponentType