From 98bf0e2cc08917abed9451e356aadec888aa92b1 Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Mon, 30 Dec 2024 15:49:47 +0200 Subject: [PATCH] Merge pull request #54652 from callstack-internal/fix/app-crash-in-group-chat fix: prevent app crash in group chat when going back online (cherry picked from commit 9debee9bc6066811293ba078e24364a1d1f3a7d9) (CP triggered by Beamanator) --- src/pages/ReportDetailsPage.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx index 15de7a6e5f4a..4a674d6e80a1 100644 --- a/src/pages/ReportDetailsPage.tsx +++ b/src/pages/ReportDetailsPage.tsx @@ -87,9 +87,11 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta const backTo = route.params.backTo; // The app would crash due to subscribing to the entire report collection if parentReportID is an empty string. So we should have a fallback ID here. - const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report.parentReportID}`); - const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID}`); - const [parentReportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.parentReportID}`); + /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ + const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report.parentReportID || CONST.DEFAULT_NUMBER_ID}`); + const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID || CONST.DEFAULT_NUMBER_ID}`); + const [parentReportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.parentReportID || CONST.DEFAULT_NUMBER_ID}`); + /* eslint-enable @typescript-eslint/prefer-nullish-coalescing */ const {reportActions} = usePaginatedReportActions(report.reportID); const {currentSearchHash} = useSearchContext();