Navigate back to taxes list when tax detail RHN can't find tax#87175
Navigate back to taxes list when tax detail RHN can't find tax#87175allgandalf wants to merge 4 commits intoExpensify:mainfrom
Conversation
|
@eVoloshchak Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
@eVoloshchak any updates on the review ? |
|
@allgandalf, tests well on native and web, but on mWeb "Hmm it's not here" page is still visible for a split second during the navigation back Screen.Recording.2026-04-10.at.09.46.17.mov
|
|
hmmm, i remember we faced similar bugs elsewhere before, do you know any possible solution ? |
|
#85000 is the first that comes to mind.
But here the cause is different, we show "Hmm it's not here" when loading is finished, but navigation animation is still in progress We navigate away if there is no If no, I think we can simply return |
|
@MelvinBot any solution to this #87175 (comment), how did we fix such issues previously |
|
The flash happens because the Fix: Move the redirect logic into the render phase. Instead of showing - if (!currentTaxRate) {
- return <NotFoundPage />;
+ if (!currentTaxRate) {
+ if (policy?.taxRates?.taxes) {
+ // Tax was removed/renamed — useEffect will navigate back; render nothing to avoid flash
+ return null;
+ }
+ return <NotFoundPage />;
}This way, when taxes are loaded but the specific tax is gone (the redirect case), nothing renders during the brief window before Precedent in the codebaseSeveral places use this pattern:
The common principle: don't render the not-found UI when you already know you're about to navigate away. |


Explanation of Change
When a tax code is changed in OldDot while the tax detail RHN is open in NewDot, the page shows "Hmm it's not here" because the route param (taxID) becomes stale. The primary fix is on the backend (Expensify/Auth#20872) which adds
previousTaxCodeto the Pusher push sogetCurrentTaxID()can resolve renamed taxes.This PR adds a frontend fallback: if the tax can't be found and the policy has taxes loaded, navigate back to the taxes list instead of showing the not-found page. This handles edge cases like the brief race window or if the tax is deleted entirely.
Fixed Issues
$ #75052
Tests
Offline tests
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand 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
Screen.Recording.2026-04-09.at.8.40.38.AM.mov