Skip to content

Commit 98bf0e2

Browse files
BeamanatorOSBotify
authored andcommitted
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 9debee9) (CP triggered by Beamanator)
1 parent 0340697 commit 98bf0e2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/pages/ReportDetailsPage.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,11 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
8787
const backTo = route.params.backTo;
8888

8989
// 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.
90-
const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report.parentReportID}`);
91-
const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID}`);
92-
const [parentReportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.parentReportID}`);
90+
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
91+
const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report.parentReportID || CONST.DEFAULT_NUMBER_ID}`);
92+
const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID || CONST.DEFAULT_NUMBER_ID}`);
93+
const [parentReportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.parentReportID || CONST.DEFAULT_NUMBER_ID}`);
94+
/* eslint-enable @typescript-eslint/prefer-nullish-coalescing */
9395
const {reportActions} = usePaginatedReportActions(report.reportID);
9496
const {currentSearchHash} = useSearchContext();
9597

0 commit comments

Comments
 (0)