From fcc94f370232f317896023e494c61b0cd777f626 Mon Sep 17 00:00:00 2001 From: MelvinBot Date: Thu, 26 Feb 2026 19:17:17 +0000 Subject: [PATCH] Fix 'Not Found' page flash after deleting expense The deleteTransactionNavigateBackUrl clearing effect in DeleteTransactionNavigateBackHandler had an inverted focus condition compared to SearchMoneyRequestReportPage. It cleared the guard URL while the screen was still focused, allowing the Not Found page to briefly flash before navigation completed. Changed the condition to only clear after navigating away, matching the established pattern. Co-authored-by: Krishna --- src/pages/inbox/DeleteTransactionNavigateBackHandler.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/inbox/DeleteTransactionNavigateBackHandler.tsx b/src/pages/inbox/DeleteTransactionNavigateBackHandler.tsx index 3391067b22123..d5cfc415ca2a1 100644 --- a/src/pages/inbox/DeleteTransactionNavigateBackHandler.tsx +++ b/src/pages/inbox/DeleteTransactionNavigateBackHandler.tsx @@ -9,20 +9,20 @@ import ONYXKEYS from '@src/ONYXKEYS'; /** * Component that does not render anything but isolates the NVP_DELETE_TRANSACTION_NAVIGATE_BACK_URL * subscription from ReportScreen. Clears the URL after interactions complete - * when the report is focused. + * when the report is no longer focused. */ function DeleteTransactionNavigateBackHandler() { const isFocused = useIsFocused(); const [deleteTransactionNavigateBackUrl] = useOnyx(ONYXKEYS.NVP_DELETE_TRANSACTION_NAVIGATE_BACK_URL); useEffect(() => { - if (!isFocused || !deleteTransactionNavigateBackUrl) { + if (isFocused || !deleteTransactionNavigateBackUrl) { return; } if (doesDeleteNavigateBackUrlIncludeDuplicatesReview(deleteTransactionNavigateBackUrl)) { return; } - // Clear the URL after all interactions are processed to ensure all updates are completed before hiding the skeleton + // Clear the URL only after we navigate away to avoid a brief Not Found flash. // eslint-disable-next-line @typescript-eslint/no-deprecated InteractionManager.runAfterInteractions(() => { requestAnimationFrame(() => {