@@ -36,7 +36,6 @@ import ControlSelection from '@libs/ControlSelection';
3636import { canUseTouchScreen , hasHoverSupport } from '@libs/DeviceCapabilities' ;
3737import type { OnyxDataWithErrors } from '@libs/ErrorUtils' ;
3838import { getLatestErrorMessageField , isReceiptError } from '@libs/ErrorUtils' ;
39- import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID' ;
4039import { isReportMessageAttachment } from '@libs/isReportMessageAttachment' ;
4140import type { PlatformStackNavigationProp } from '@libs/Navigation/PlatformStackNavigation/types' ;
4241import type { ReportsSplitNavigatorParamList } from '@libs/Navigation/types' ;
@@ -97,6 +96,9 @@ type ReportActionItemProps = {
9796 /** The transaction thread report associated with the report for this action, if any */
9897 transactionThreadReport : OnyxEntry < OnyxTypes . Report > ;
9998
99+ /** The chat report associated with the report for this action (report.chatReportID) */
100+ chatReport : OnyxEntry < OnyxTypes . Report > ;
101+
100102 /** Report action belonging to the report's parent */
101103 parentReportAction : OnyxEntry < OnyxTypes . ReportAction > ;
102104
@@ -153,6 +155,7 @@ function ReportActionItem({
153155 action,
154156 report,
155157 transactionThreadReport,
158+ chatReport,
156159 linkedReportActionID,
157160 displayAsGroup,
158161 parentReportAction,
@@ -171,8 +174,7 @@ function ReportActionItem({
171174} : ReportActionItemProps ) {
172175 const reportID = report ?. reportID ?? action ?. reportID ;
173176 const originalReportID = useOriginalReportID ( report ?. reportID , action ) ;
174- const [ originalReport ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ originalReportID } ` , { selector : getStableReportSelector } ) ;
175- const [ iouReport ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ getIOUReportIDFromReportActionPreview ( action ) } ` ) ;
177+ const [ iouReport ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ getIOUReportIDFromReportActionPreview ( action ) } ` , { selector : getStableReportSelector } ) ;
176178
177179 const [ isTrackIntentUser ] = useOnyx ( ONYXKEYS . NVP_INTRO_SELECTED , { selector : isTrackIntentUserSelector } ) ;
178180 const transactionsOnIOUReport = useReportTransactions ( iouReport ?. reportID ) ;
@@ -210,8 +212,6 @@ function ReportActionItem({
210212
211213 const shouldRenderViewBasedOnAction = useTableReportViewActionRenderConditionals ( action ) ;
212214
213- const [ chatReport ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ getNonEmptyStringOnyxID ( report ?. chatReportID ) } ` ) ;
214-
215215 const highlightedBackgroundColorIfNeeded = isReportActionLinked || shouldHighlight ? StyleUtils . getBackgroundColorStyle ( theme . messageHighlightBG ) : { } ;
216216
217217 const isDeletedParentAction = isDeletedParentActionUtils ( action ) ;
@@ -594,7 +594,6 @@ function ReportActionItem({
594594 action = { action }
595595 report = { report }
596596 reportID = { reportID }
597- originalReport = { originalReport }
598597 originalReportID = { originalReportID }
599598 iouReport = { iouReport }
600599 displayAsGroup = { displayAsGroup }
0 commit comments