From eb29d41a76b9bedbb2ab22a2c99b6d561d8eefed Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Sat, 20 Apr 2024 14:03:28 +0800 Subject: [PATCH 1/2] fix multiple open report when mounted --- src/pages/home/ReportScreen.tsx | 7 ------- src/pages/home/report/ReportActionsView.tsx | 18 ------------------ 2 files changed, 25 deletions(-) diff --git a/src/pages/home/ReportScreen.tsx b/src/pages/home/ReportScreen.tsx index cbd388d0f7dc1..db42b101238e8 100644 --- a/src/pages/home/ReportScreen.tsx +++ b/src/pages/home/ReportScreen.tsx @@ -416,13 +416,6 @@ function ReportScreen({ return; } - // It is possible that we may not have the report object yet in Onyx yet e.g. we navigated to a URL for an accessible report that - // is not stored locally yet. If report.reportID exists, then the report has been stored locally and nothing more needs to be done. - // If it doesn't exist, then we fetch the report from the API. - if (report.reportID && report.reportID === reportIDFromRoute && !reportMetadata?.isLoadingInitialReportActions) { - return; - } - if (!shouldFetchReport(report)) { return; } diff --git a/src/pages/home/report/ReportActionsView.tsx b/src/pages/home/report/ReportActionsView.tsx index 3e3ebf1a9cc3a..6579db9bd76d6 100755 --- a/src/pages/home/report/ReportActionsView.tsx +++ b/src/pages/home/report/ReportActionsView.tsx @@ -235,24 +235,6 @@ function ReportActionsView({ const oldestReportAction = useMemo(() => reportActions?.at(-1), [reportActions]); const hasCreatedAction = oldestReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED; - useEffect(() => { - if (reportActionID) { - return; - } - - const interactionTask = InteractionManager.runAfterInteractions(() => { - openReportIfNecessary(); - }); - // eslint-disable-next-line @typescript-eslint/no-misused-promises - if (interactionTask) { - return () => { - interactionTask.cancel(); - }; - } - - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - useEffect(() => { if (!reportActionID || indexOfLinkedAction > -1) { return; From 257c1de6f9b710d55df435351cd42d1d302fb1d7 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Sat, 20 Apr 2024 14:21:22 +0800 Subject: [PATCH 2/2] remove unnecessary deps --- src/pages/home/ReportScreen.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/ReportScreen.tsx b/src/pages/home/ReportScreen.tsx index db42b101238e8..74babb9b0b41f 100644 --- a/src/pages/home/ReportScreen.tsx +++ b/src/pages/home/ReportScreen.tsx @@ -421,7 +421,7 @@ function ReportScreen({ } fetchReport(); - }, [report, reportMetadata?.isLoadingInitialReportActions, fetchReport, reportIDFromRoute]); + }, [report, fetchReport, reportIDFromRoute]); const dismissBanner = useCallback(() => { setIsBannerVisible(false);