1- import React , { useCallback , useMemo } from 'react' ;
1+ import React , { useCallback , useEffect , useMemo } from 'react' ;
22import HeaderWithBackButton from '@components/HeaderWithBackButton' ;
33import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription' ;
44import ScreenWrapper from '@components/ScreenWrapper' ;
@@ -10,6 +10,7 @@ import useLocalize from '@hooks/useLocalize';
1010import useOnyx from '@hooks/useOnyx' ;
1111import useThemeStyles from '@hooks/useThemeStyles' ;
1212import { getConnectionNameFromRouteParam } from '@libs/AccountingUtils' ;
13+ import { openPolicyAccountingPage } from '@libs/actions/PolicyConnections' ;
1314import { isExpensifyCardFullySetUp } from '@libs/CardUtils' ;
1415import type { PlatformStackScreenProps } from '@libs/Navigation/PlatformStackNavigation/types' ;
1516import Navigation from '@navigation/Navigation' ;
@@ -104,6 +105,20 @@ function CardReconciliationPage({policy, route}: CardReconciliationPageProps) {
104105 }
105106 } , [ connection , policyID ] ) ;
106107
108+ const fetchPolicyAccountingData = useCallback ( ( ) => {
109+ if ( ! policyID ) {
110+ return ;
111+ }
112+ openPolicyAccountingPage ( policyID ) ;
113+ } , [ policyID ] ) ;
114+
115+ useEffect ( ( ) => {
116+ if ( isContinuousReconciliationOn !== undefined ) {
117+ return ;
118+ }
119+ fetchPolicyAccountingData ( ) ;
120+ } , [ isContinuousReconciliationOn , fetchPolicyAccountingData ] ) ;
121+
107122 return (
108123 < AccessOrNotFoundWrapper
109124 policyID = { policyID }
0 commit comments