From 2c94cf5181e43c2b465ff541879c6ddbed2fe6cb Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Mon, 28 Oct 2024 14:05:36 +0700 Subject: [PATCH 1/2] fix: App crashes when opening user profile --- src/pages/home/report/withReportAndReportActionOrNotFound.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/withReportAndReportActionOrNotFound.tsx b/src/pages/home/report/withReportAndReportActionOrNotFound.tsx index f291d71c75e8..56b6753f76be 100644 --- a/src/pages/home/report/withReportAndReportActionOrNotFound.tsx +++ b/src/pages/home/report/withReportAndReportActionOrNotFound.tsx @@ -38,13 +38,13 @@ export default function > { function WithReportOrNotFound(props: TProps, ref: ForwardedRef) { const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${props.route.params.reportID}`); - const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report ? report.parentReportID : '-1'}`); + const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID ?? '-1'}`); const [reportMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${props.route.params.reportID}`); const [isLoadingReportData] = useOnyx(ONYXKEYS.IS_LOADING_REPORT_DATA); const [betas] = useOnyx(ONYXKEYS.BETAS); const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY); const [reportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${props.route.params.reportID}`, {canEvict: false}); - const [parentReportAction] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report ? report.parentReportID : '-1'}`, { + const [parentReportAction] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.parentReportID ?? '-1'}`, { selector: (parentReportActions) => { const parentReportActionID = report?.parentReportActionID; if (!parentReportActionID) { From df49b8a0015383873b230e114f7514ed380432ad Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Tue, 29 Oct 2024 17:09:24 +0700 Subject: [PATCH 2/2] disable eslint --- .../home/report/withReportAndReportActionOrNotFound.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/withReportAndReportActionOrNotFound.tsx b/src/pages/home/report/withReportAndReportActionOrNotFound.tsx index 56b6753f76be..aaddb37f7822 100644 --- a/src/pages/home/report/withReportAndReportActionOrNotFound.tsx +++ b/src/pages/home/report/withReportAndReportActionOrNotFound.tsx @@ -38,13 +38,15 @@ export default function > { function WithReportOrNotFound(props: TProps, ref: ForwardedRef) { const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${props.route.params.reportID}`); - const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID ?? '-1'}`); + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID || '-1'}`); const [reportMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${props.route.params.reportID}`); const [isLoadingReportData] = useOnyx(ONYXKEYS.IS_LOADING_REPORT_DATA); const [betas] = useOnyx(ONYXKEYS.BETAS); const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY); const [reportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${props.route.params.reportID}`, {canEvict: false}); - const [parentReportAction] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.parentReportID ?? '-1'}`, { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + const [parentReportAction] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.parentReportID || '-1'}`, { selector: (parentReportActions) => { const parentReportActionID = report?.parentReportActionID; if (!parentReportActionID) {