Skip to content

Commit

Permalink
Merge pull request #54652 from callstack-internal/fix/app-crash-in-gr…
Browse files Browse the repository at this point in the history
…oup-chat

fix: prevent app crash in group chat when going back online
(cherry picked from commit 9debee9)

(CP triggered by Beamanator)
  • Loading branch information
Beamanator authored and OSBotify committed Dec 30, 2024
1 parent 0340697 commit 98bf0e2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/pages/ReportDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 98bf0e2

Please sign in to comment.