From 0c14761ef6c44a00b6044bae25952a60b449978c Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Thu, 20 Jun 2024 10:32:19 +0700 Subject: [PATCH] edit comment --- src/components/SettlementButton.tsx | 2 +- src/pages/home/report/ReportActionItem.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/SettlementButton.tsx b/src/components/SettlementButton.tsx index fe689e989064..2b1cd0729c0b 100644 --- a/src/components/SettlementButton.tsx +++ b/src/components/SettlementButton.tsx @@ -144,7 +144,7 @@ function SettlementButton({ const {isOffline} = useNetwork(); const session = useSession(); - // The chatReportID can be an empty string that can make the app crashes if we use a nullish ?? operator + // The app would crash due to subscribing to the entire report collection if chatReportID is an empty string. So we should have a fallback ID here. const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${chatReportID || -1}`); const isInvoiceReport = (!isEmptyObject(iouReport) && ReportUtils.isInvoiceReport(iouReport)) || false; const isPaidGroupPolicy = ReportUtils.isPaidGroupPolicyExpenseChat(chatReport); diff --git a/src/pages/home/report/ReportActionItem.tsx b/src/pages/home/report/ReportActionItem.tsx index 580df3f46b9e..7399db1df15f 100644 --- a/src/pages/home/report/ReportActionItem.tsx +++ b/src/pages/home/report/ReportActionItem.tsx @@ -200,7 +200,7 @@ function ReportActionItem({ const downloadedPreviews = useRef([]); const prevDraftMessage = usePrevious(draftMessage); const originalReportID = ReportUtils.getOriginalReportID(report.reportID, action); - // The parentReportID can be an empty string that can make the app crashes if we use a nullish ?? operator + // 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. // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report.parentReportID || -1}`); const isReportActionLinked = linkedReportActionID && action.reportActionID && linkedReportActionID === action.reportActionID;