From da0b80bab4da33c1b983e98dbb43dfe8a7d3fa8d Mon Sep 17 00:00:00 2001 From: Mahesh Vagicherla Date: Sun, 3 Sep 2023 17:13:12 +0530 Subject: [PATCH 1/5] fix not found page on thread leave --- src/pages/home/ReportScreen.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index 6daa15785921..faeafe54259d 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -284,6 +284,8 @@ function ReportScreen({ ComposerActions.setShouldShowComposeInput(true); }, [route, report, errors, fetchReportIfNeeded, prevReport.reportID]); + console.log(report); + return ( Date: Sun, 3 Sep 2023 17:32:20 +0530 Subject: [PATCH 2/5] remove console --- src/pages/home/ReportScreen.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index faeafe54259d..7ee049319436 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -284,8 +284,6 @@ function ReportScreen({ ComposerActions.setShouldShowComposeInput(true); }, [route, report, errors, fetchReportIfNeeded, prevReport.reportID]); - console.log(report); - return ( Date: Wed, 6 Sep 2023 21:31:47 +0530 Subject: [PATCH 3/5] fix shouldShow condition for report --- src/pages/home/ReportScreen.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index 7ee049319436..56f55a13c0cb 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -37,6 +37,8 @@ import ReportScreenContext from './ReportScreenContext'; import TaskHeaderActionButton from '../../components/TaskHeaderActionButton'; import DragAndDropProvider from '../../components/DragAndDrop/Provider'; import usePrevious from '../../hooks/usePrevious'; +import CONST from '../../CONST'; +import withReportOrNotFound from './report/withReportOrNotFound'; const propTypes = { /** Navigation route context info provided by react navigation */ @@ -104,6 +106,15 @@ const defaultProps = { personalDetails: {}, }; +/** + * + * Function to check weather the report available in props is default + * + * @param {Object} report + * @returns {Boolean} + */ +const checkDefaultReport = (report) => report === defaultProps.report; + /** * Get the currently viewed report ID as number * @@ -147,6 +158,8 @@ function ReportScreen({ // There are no reportActions at all to display and we are still in the process of loading the next set of actions. const isLoadingInitialReportActions = _.isEmpty(reportActions) && report.isLoadingReportActions; + const isOptimisticDelete = lodashGet(report, 'statusNum') === CONST.REPORT.STATUS.CLOSED; + const shouldHideReport = !ReportUtils.canAccessReport(report, policies, betas); const isLoading = !reportID || !isSidebarLoaded || _.isEmpty(personalDetails) || firstRenderRef.current; @@ -159,6 +172,8 @@ function ReportScreen({ const isTopMostReportId = Navigation.getTopmostReportId() === getReportID(route); + const isDefaultReport = checkDefaultReport(report); + let headerView = ( (!_.isEmpty(report) && !isDefaultReport && !report.reportID && !isOptimisticDelete && !report.isLoadingReportActions && !isLoading) || shouldHideReport, + [report, isLoading, shouldHideReport, isDefaultReport, isOptimisticDelete], + ); + return ( Date: Sun, 10 Sep 2023 18:27:35 +0530 Subject: [PATCH 4/5] remove unused import --- src/pages/home/ReportScreen.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index 56f55a13c0cb..ca8abef48cda 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -38,7 +38,6 @@ import TaskHeaderActionButton from '../../components/TaskHeaderActionButton'; import DragAndDropProvider from '../../components/DragAndDrop/Provider'; import usePrevious from '../../hooks/usePrevious'; import CONST from '../../CONST'; -import withReportOrNotFound from './report/withReportOrNotFound'; const propTypes = { /** Navigation route context info provided by react navigation */ From 07e0a5a5e939078573c7d46008a4ebb7e3682809 Mon Sep 17 00:00:00 2001 From: Mahesh Date: Thu, 14 Sep 2023 20:28:31 +0530 Subject: [PATCH 5/5] small changes --- src/pages/home/ReportScreen.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index 19c8732dcfa0..84599d233452 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -302,7 +302,8 @@ function ReportScreen({ ComposerActions.setShouldShowComposeInput(true); }, [route, report, errors, fetchReportIfNeeded, prevReport.reportID]); - const isReportAvailable = useMemo( + // eslint-disable-next-line rulesdir/no-negated-variables + const shouldShowNotFoundPage = useMemo( () => (!_.isEmpty(report) && !isDefaultReport && !report.reportID && !isOptimisticDelete && !report.isLoadingReportActions && !isLoading) || shouldHideReport, [report, isLoading, shouldHideReport, isDefaultReport, isOptimisticDelete], ); @@ -320,7 +321,7 @@ function ReportScreen({ shouldDisableFocusTrap >