From a078069d0dcd73a22226874f74fe7a472a9dc854 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Thu, 8 Jun 2023 03:03:14 +0700 Subject: [PATCH 1/4] fix page loads infinitely --- src/libs/actions/Report.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index ef5a1370dcc6..702caea1819d 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -385,7 +385,6 @@ function openReport(reportID, participantList = [], newReportObject = {}, parent optimisticReportData.onyxMethod = Onyx.METHOD.SET; optimisticReportData.value = { ...optimisticReportData.value, - reportID: reportID.toString(), }; } From 922b514502dc3b744d13fca96236a1d32cd6044d Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Thu, 8 Jun 2023 03:05:48 +0700 Subject: [PATCH 2/4] fix error when not authenticated --- src/libs/ReportUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 21886511df30..c55f111c4f79 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -1048,7 +1048,7 @@ function getReportName(report) { * @returns {Object} */ function getReport(reportID) { - return allReports[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; + return _.isEmpty(allReports) ? {} : allReports[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; } /** From 41b159c336b6c586b359e5f14f76049572824a92 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Thu, 8 Jun 2023 03:16:04 +0700 Subject: [PATCH 3/4] resolve conflict --- src/libs/ReportUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index c55f111c4f79..790f827ae989 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -1048,7 +1048,7 @@ function getReportName(report) { * @returns {Object} */ function getReport(reportID) { - return _.isEmpty(allReports) ? {} : allReports[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; + return lodashGet(allReports, `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {}); } /** From 0df3e93501b202a6806cf3104be8d6e2e3d669a1 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Thu, 8 Jun 2023 03:32:10 +0700 Subject: [PATCH 4/4] refactor code --- src/libs/actions/Report.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 702caea1819d..5e515c8080db 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -383,9 +383,6 @@ function openReport(reportID, participantList = [], newReportObject = {}, parent // and we need data to be available when we navigate to the chat page if (_.isEmpty(ReportUtils.getReport(reportID))) { optimisticReportData.onyxMethod = Onyx.METHOD.SET; - optimisticReportData.value = { - ...optimisticReportData.value, - }; } // If we are creating a new report, we need to add the optimistic report data and a report action