Skip to content

Commit

Permalink
Merge pull request #51920 from bernhardoj/fix/51388-deleting-report-f…
Browse files Browse the repository at this point in the history
…rom-debug-leads-to-blank-page

Fix blank view when report is deleted
  • Loading branch information
lakchote authored Nov 7, 2024
2 parents afa7b33 + 18ea401 commit ca0471d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pages/home/report/withReportOrNotFound.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable rulesdir/no-negated-variables */
import type {RouteProp} from '@react-navigation/native';
import {useIsFocused} from '@react-navigation/native';
import type {ComponentType, ForwardedRef, RefAttributes} from 'react';
import React, {useEffect} from 'react';
import {useOnyx} from 'react-native-onyx';
Expand Down Expand Up @@ -60,6 +61,7 @@ export default function (
const [reportMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${props.route.params.reportID}`);
const [isLoadingReportData] = useOnyx(ONYXKEYS.IS_LOADING_REPORT_DATA);
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${props.route.params.reportID}`);
const isFocused = useIsFocused();
const contentShown = React.useRef(false);
const isReportIdInRoute = !!props.route.params.reportID?.length;
const isReportLoaded = !isEmptyObject(report) && !!report?.reportID;
Expand All @@ -86,7 +88,7 @@ export default function (
// If the content was shown, but it's not anymore, that means the report was deleted, and we are probably navigating out of this screen.
// Return null for this case to avoid rendering FullScreenLoadingIndicator or NotFoundPage when animating transition.
// eslint-disable-next-line react-compiler/react-compiler
if (shouldShowNotFoundPage && contentShown.current) {
if (shouldShowNotFoundPage && contentShown.current && !isFocused) {
return null;
}

Expand Down

0 comments on commit ca0471d

Please sign in to comment.