From fec3aa372ec4e56baf2910e29553f03b3959a4a9 Mon Sep 17 00:00:00 2001 From: NikkiWines Date: Thu, 28 Mar 2024 00:56:34 -0700 Subject: [PATCH] pass transactionThreadReportID from ReportScreen --- src/pages/home/ReportScreen.tsx | 1 + src/pages/home/report/ReportActionsView.tsx | 14 ++++++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/pages/home/ReportScreen.tsx b/src/pages/home/ReportScreen.tsx index 9bc0c4c3a4a8..7f94818d1715 100644 --- a/src/pages/home/ReportScreen.tsx +++ b/src/pages/home/ReportScreen.tsx @@ -634,6 +634,7 @@ function ReportScreen({ isLoadingNewerReportActions={reportMetadata?.isLoadingNewerReportActions} isLoadingOlderReportActions={reportMetadata?.isLoadingOlderReportActions} isReadyForCommentLinking={!shouldShowSkeleton} + transactionThreadReportID={ReportActionsUtils.getOneTransactionThreadReportID(reportActions ?? [])} /> )} diff --git a/src/pages/home/report/ReportActionsView.tsx b/src/pages/home/report/ReportActionsView.tsx index 0266f7f682a9..a407906d5ccb 100755 --- a/src/pages/home/report/ReportActionsView.tsx +++ b/src/pages/home/report/ReportActionsView.tsx @@ -62,6 +62,10 @@ type ReportActionsViewProps = ReportActionsViewOnyxProps & { /** Whether the report is ready for comment linking */ isReadyForCommentLinking?: boolean; + + /** The reportID of the transaction thread report associated with this current report, if any */ + // eslint-disable-next-line react/no-unused-prop-types + transactionThreadReportID?: string | null; }; const DIFF_BETWEEN_SCREEN_HEIGHT_AND_LIST = 120; @@ -541,18 +545,12 @@ export default Performance.withRenderTrace({id: ' rendering'} key: ONYXKEYS.SESSION, }, transactionThreadReportActions: { - key: ({reportActions}) => { - const transactionThreadReportID = ReportActionsUtils.getOneTransactionThreadReportID(reportActions ?? []); - return `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReportID}`; - }, + key: ({transactionThreadReportID}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReportID}`, canEvict: false, selector: (reportActions: OnyxEntry) => ReportActionsUtils.getSortedReportActionsForDisplay(reportActions, true), }, transactionThreadReport: { - key: ({reportActions}) => { - const transactionThreadReportID = ReportActionsUtils.getOneTransactionThreadReportID(reportActions ?? []); - return `${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReportID}`; - }, + key: ({transactionThreadReportID}) => `${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReportID}`, }, })(MemoizedReportActionsView), );