@@ -52,7 +52,7 @@ import {isTrackIntentUserSelector} from '@selectors/Onboarding';
5252import React from 'react' ;
5353// Use the original useOnyx hook to get the real-time data from Onyx and not from the snapshot
5454// eslint-disable-next-line no-restricted-imports
55- import { useOnyx as originalUseOnyx } from 'react-native-onyx' ;
55+ import { useOnyx as useOnyxWithoutSnapshots } from 'react-native-onyx' ;
5656
5757import TransactionListItemNarrow from './TransactionListItemNarrow' ;
5858import TransactionListItemWide from './TransactionListItemWide' ;
@@ -118,36 +118,36 @@ function TransactionListItemInner<TItem extends ListItem>({
118118 if ( ! policyID && transactionItem . reportID === CONST . REPORT . UNREPORTED_REPORT_ID ) {
119119 policyID = policyForMovingExpensesID ;
120120 }
121- const [ parentPolicy ] = originalUseOnyx ( `${ ONYXKEYS . COLLECTION . POLICY } ${ getNonEmptyStringOnyxID ( policyID ) } ` ) ;
121+ const [ parentPolicy ] = useOnyxWithoutSnapshots ( `${ ONYXKEYS . COLLECTION . POLICY } ${ getNonEmptyStringOnyxID ( policyID ) } ` ) ;
122122 const snapshotPolicy = ( currentSearchResults ?. data ?. [ `${ ONYXKEYS . COLLECTION . POLICY } ${ transactionItem . policyID } ` ] ?? { } ) as Policy ;
123123
124124 const actionsData = currentSearchResults ?. data ?. [ `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ transactionItem . reportID } ` ] ;
125125 const reportActions = actionsData ? Object . values ( actionsData ) : [ ] ;
126126
127127 // Fetch policy categories directly from Onyx since they are not included in the search snapshot
128- const [ policyCategories ] = originalUseOnyx ( `${ ONYXKEYS . COLLECTION . POLICY_CATEGORIES } ${ getNonEmptyStringOnyxID ( policyID ) } ` ) ;
128+ const [ policyCategories ] = useOnyxWithoutSnapshots ( `${ ONYXKEYS . COLLECTION . POLICY_CATEGORIES } ${ getNonEmptyStringOnyxID ( policyID ) } ` ) ;
129129 // Fetch policy tags directly from Onyx (not in the snapshot) so the Tag GL code cell can resolve.
130- const [ policyTagLists ] = originalUseOnyx ( `${ ONYXKEYS . COLLECTION . POLICY_TAGS } ${ getNonEmptyStringOnyxID ( policyID ) } ` ) ;
130+ const [ policyTagLists ] = useOnyxWithoutSnapshots ( `${ ONYXKEYS . COLLECTION . POLICY_TAGS } ${ getNonEmptyStringOnyxID ( policyID ) } ` ) ;
131131
132- const [ parentReport ] = originalUseOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ getNonEmptyStringOnyxID ( transactionItem . reportID ) } ` ) ;
133- const [ transactionThreadReport ] = originalUseOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ transactionItem ?. reportAction ?. childReportID } ` ) ;
132+ const [ parentReport ] = useOnyxWithoutSnapshots ( `${ ONYXKEYS . COLLECTION . REPORT } ${ getNonEmptyStringOnyxID ( transactionItem . reportID ) } ` ) ;
133+ const [ transactionThreadReport ] = useOnyxWithoutSnapshots ( `${ ONYXKEYS . COLLECTION . REPORT } ${ transactionItem ?. reportAction ?. childReportID } ` ) ;
134134 const [ submitterLogin ] = useOnyx ( ONYXKEYS . PERSONAL_DETAILS_LIST , { selector : personalDetailsLoginSelector ( transactionItem ?. report ?. ownerAccountID ) } ) ;
135- const [ transaction ] = originalUseOnyx ( `${ ONYXKEYS . COLLECTION . TRANSACTION } ${ getNonEmptyStringOnyxID ( transactionItem . transactionID ) } ` ) ;
135+ const [ transaction ] = useOnyxWithoutSnapshots ( `${ ONYXKEYS . COLLECTION . TRANSACTION } ${ getNonEmptyStringOnyxID ( transactionItem . transactionID ) } ` ) ;
136136 const transactionViolationsKey = `${ ONYXKEYS . COLLECTION . TRANSACTION_VIOLATIONS } ${ getNonEmptyStringOnyxID ( transactionItem . transactionID ) } ` as const ;
137- const [ transactionViolationsForRow ] = originalUseOnyx ( transactionViolationsKey ) ;
137+ const [ transactionViolationsForRow ] = useOnyxWithoutSnapshots ( transactionViolationsKey ) ;
138138 const allViolations : OnyxCollection < TransactionViolations > = { [ transactionViolationsKey ] : transactionViolationsForRow } ;
139139 const parentReportActionID = transactionItem ?. reportAction ?. reportActionID ;
140- const [ parentReportAction ] = originalUseOnyx ( `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ getNonEmptyStringOnyxID ( transactionItem . reportID ) } ` , {
140+ const [ parentReportAction ] = useOnyxWithoutSnapshots ( `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ getNonEmptyStringOnyxID ( transactionItem . reportID ) } ` , {
141141 selector : ( actions : OnyxEntry < ReportActions > ) : OnyxEntry < ReportAction > => actions ?. [ `${ parentReportActionID } ` ] ,
142142 } ) ;
143143 const currentUserDetails = useCurrentUserPersonalDetails ( ) ;
144144 const chatReportID = snapshotReport ?. chatReportID ?? snapshotReport ?. parentReportID ;
145- const [ parentChatReport ] = originalUseOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ getNonEmptyStringOnyxID ( chatReportID ) } ` ) ;
145+ const [ parentChatReport ] = useOnyxWithoutSnapshots ( `${ ONYXKEYS . COLLECTION . REPORT } ${ getNonEmptyStringOnyxID ( chatReportID ) } ` ) ;
146146 // Fall back to the search snapshot when the chat report isn't in live Onyx yet (e.g. offline or not fetched),
147147 // matching the grouped-report path in ReportListItemHeader so the Pay flow can still resolve the chat report.
148148 const snapshotChatReport = chatReportID ? snapshotData ?. [ `${ ONYXKEYS . COLLECTION . REPORT } ${ chatReportID } ` ] : undefined ;
149149 const chatReport = parentChatReport ?? snapshotChatReport ;
150- const [ chatReportActions ] = originalUseOnyx ( `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ getNonEmptyStringOnyxID ( chatReport ?. reportID ?? chatReportID ) } ` ) ;
150+ const [ chatReportActions ] = useOnyxWithoutSnapshots ( `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ getNonEmptyStringOnyxID ( chatReport ?. reportID ?? chatReportID ) } ` ) ;
151151 const { amountOwed, currentUserAccountID, currentUserLogin, introSelected, betas, isSelfTourViewed, activePolicy, chatReportPolicy, delegateEmail, delegateAccountID, conciergeChat} =
152152 useReportPaymentContext ( {
153153 chatReportPolicyID : chatReport ?. policyID ,
0 commit comments