Fix 'Not Found' page flash after deleting expense#83613
Fix 'Not Found' page flash after deleting expense#83613
Conversation
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 <Krishna2323@users.noreply.github.com>
|
I created this PR from an upstream branch since I don't have push access to your fork. To take ownership of this branch and be able to push updates, run: Then you can close this PR and open a new one from your fork. |
|
@MelvinBot The issue is not fixed. While keeping the updates seems reasonable to me, the root cause appears to be a timing issue. This only occurs on slower devices, where it takes some time for the RHP/Details page to close after the report is deleted. During that transition, the “Not Found” page becomes briefly visible while the RHP is closing. |
|
Thanks for the feedback Root CauseThe if (shouldShowNotFoundPage && contentShown.current && !isFocused) {
return null; // prevents NotFound during close animation
}This guard only returns
Precedent in the CodebaseThis exact pattern is already handled for transaction duplicate reviews in // Delay clearing review duplicate data till the RHP is completely closed
// to avoid not found showing briefly in confirmation page when RHP is closing
InteractionManager.runAfterInteractions(() => {
abandonReviewDuplicateTransactions();
});Suggested FixThe Navigation.setNavigationActionToMicrotaskQueue(() => {
navigateToTargetUrl();
// Delay deletion until RHP close animation finishes
InteractionManager.runAfterInteractions(() => {
deleteTransaction();
});
});This ensures the report data stays intact while the RHP is still visible and animating closed. The condition fix in this PR (clearing the guard when Want me to update this PR with the |
Explanation of Change
The
DeleteTransactionNavigateBackHandlercomponent (used byReportScreen) had an inverted focus condition when clearing thedeleteTransactionNavigateBackUrlguard. It was clearing the guard while the screen was still focused (!isFocused), which allowedshouldShowNotFoundPageto briefly evaluate totruebefore navigation completed — causing a "Not Found" page flash.This fix changes the condition to
isFocused(matching the correct pattern already established inSearchMoneyRequestReportPage.tsx:111), so the guard URL is only cleared after the user has navigated away from the screen.Fixed Issues
$ #83521
PROPOSAL: #83521 (comment)
Tests
Regression test (forward button behavior from original PR #79530):
Offline tests
QA Steps
Same as Tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Not applicable - logic-only change, no UI modification.
Android: mWeb Chrome
Not applicable - logic-only change, no UI modification.
iOS: Native
Not applicable - logic-only change, no UI modification.
iOS: mWeb Safari
Not applicable - logic-only change, no UI modification.
MacOS: Chrome / Safari
Not applicable - logic-only change, no UI modification.