Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Not found page shows briefly when deleting a track expense #53408

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/libs/Navigation/Navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,9 @@ function goBack(fallbackRoute?: Route, shouldEnforceFallback = false, shouldPopT

if (shouldPopToTop) {
if (shouldPopAllStateOnUP) {
const rootState = navigationRef.getRootState();
shouldPopAllStateOnUP = false;
navigationRef.current?.dispatch(StackActions.popToTop());
navigationRef.current?.dispatch({...StackActions.popToTop(), target: rootState.key});
return;
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/pages/home/report/withReportOrNotFound.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable rulesdir/no-negated-variables */
import {useIsFocused} from '@react-navigation/native';
import type {ComponentType, ForwardedRef, RefAttributes} from 'react';
import React, {useEffect} from 'react';
import type {OnyxCollection, OnyxEntry} from 'react-native-onyx';
Expand Down Expand Up @@ -66,7 +65,6 @@ 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 @@ -93,7 +91,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 && !isFocused) {
if (shouldShowNotFoundPage && contentShown.current) {
return null;
}

Expand Down
Loading