Skip to content

Fix not-found page after clearing cache - #100859

Merged
NicolasBonet merged 6 commits into
Expensify:mainfrom
margelo:@chrispader/fix/cache-reset-not-found
Oct 2, 2026
Merged

NicolasBonet merged 6 commits into
Expensify:mainfrom
margelo:@chrispader/fix/cache-reset-not-found

Conversation

@chrispader

@chrispader chrispader commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Clearing Onyx through Account > Troubleshoot > Clear cache and restart could briefly expose partially cleared account state. The migrated-user welcome guard could then build a modal route on top of Troubleshoot, which resolves to the not-found page on every platform. This PR keeps the reset behind the existing app-loading gate and ensures dynamic welcome modals use a valid base route.

Explanation of Change

clearOnyxAndResetApp now seeds IS_LOADING_APP=true in the same operation that clears account-scoped Onyx data. Consumers therefore cannot act on the transient state between the clear and the following OpenApp request, and the fix adds no new Onyx.connect or Onyx.connectWithoutView subscription. The forced-onboarding 2FA reconnect explicitly keeps IS_LOADING_APP=false because OpenApp remains deferred until the user dismisses its success screen.

The migrated-user and Submit-plan welcome guards now share a route helper that checks whether the active screen can host their dynamic modal. If it cannot, the helper falls back to Home instead of constructing an invalid route. The migrated-user guard tests cover the reset race and the invalid Troubleshoot base path.

Fixed Issues

$ #100860
PROPOSAL: N/A

Tests

  1. Sign in with any account.
  2. Go to Account > Troubleshoot.
  3. Select Clear cache and restart, then confirm Reset and refresh.
  4. Verify the app returns to Troubleshoot and does not show the "Hmm... it's not here" page.
  5. Open a report or workspace and verify it loads normally after the reset.
  6. Repeat the reset and verify the same result.
  7. Verify that no errors appear in the JS console.
  • Verify that no errors appear in the JS console

Offline tests

  1. Sign in with any account and go to Account > Troubleshoot, then disconnect the device from the network.
  2. Select Clear cache and restart, then confirm Reset and refresh.
  3. Verify the app does not navigate to the "Hmm... it's not here" page while account data is unavailable.
  4. Restore the network connection.
  5. Verify the app finishes loading on Troubleshoot without showing the not-found page.

QA Steps

  1. Sign in to staging with any account.
  2. Open a report or workspace, then go to Account > Troubleshoot.
  3. Select Clear cache and restart, then confirm Reset and refresh.
  4. Verify the app reloads on Troubleshoot without showing the "Hmm... it's not here" page.
  5. Open a report or workspace and verify it loads. Repeat the cache reset and verify the same result.
  6. Repeat the reset while offline and verify no not-found page appears. Reconnect and verify the app finishes loading.
  7. On web, verify no errors appear in the JS console during the reset.

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Before After
ClearRefreshBugAndroid.mp4
ClearRefreshFixedAndroid.mp4
iOS: Native
Before After
ClearRefreshFixedBug.mov
ClearRefreshFixediOS.mov
MacOS: Chrome / Safari
Before After
ClearRefreshBug.mov
ClearRefreshFixed.mov

@chrispader

Copy link
Copy Markdown
Contributor Author

@MelvinBot create a GH issue for this PR and assign me to it. Update the PR description to link to this issue.

@MelvinBot

MelvinBot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Created #100860 and assigned it to chrispader. The ### Fixed Issues section of this PR now links to it.

The issue writes up both halves of the bug this PR fixes: the transient partially-cleared Onyx state in clearOnyxAndResetApp, and the migrated-user welcome guard stacking its dynamic modal onto /settings/troubleshoot, which isn't one of its entryScreens.

One thing to check before you get review: #95079 ("Clear cache & refresh goes to Humm It's not here page") describes the same user-facing symptom and was closed on 2026-07-15 as unable to reproduce. If you'd rather have this PR close out that existing issue instead, swap the link — otherwise #100860 references it under Related.


view run · view recording

@chrispader
chrispader marked this pull request as ready for review September 10, 2026 15:05
@chrispader
chrispader requested review from a team as code owners September 10, 2026 15:05
@melvin-bot
melvin-bot Bot requested review from a team, abdulrahuman5196 and garrettmknight and removed request for a team September 10, 2026 15:05
@melvin-bot

melvin-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown

@abdulrahuman5196 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]

@melvin-bot
melvin-bot Bot removed request for a team September 10, 2026 15:05
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-09-10T15:12:48.158572Z fdd81e3 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chrispader chrispader changed the title Fix not-found page after clearing cache [WIP] Fix not-found page after clearing cache Sep 10, 2026
@codecov

codecov Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
...Navigation/guards/MigratedUserWelcomeModalGuard.ts 100.00% <100.00%> (ø)
...s/Navigation/guards/SubmitPlanWelcomeModalGuard.ts 97.89% <100.00%> (+2.39%) ⬆️
src/libs/Navigation/helpers/createScheduleOnce.ts 100.00% <100.00%> (ø)
src/libs/actions/App.ts 64.43% <ø> (ø)
src/libs/actions/Delegate.ts 39.36% <100.00%> (ø)
src/libs/actions/Session/index.ts 62.87% <ø> (ø)
src/libs/actions/clearOnyxAndSeedFullReconnect.ts 100.00% <ø> (ø)
...Navigation/helpers/getValidDynamicRouteBasePath.ts 81.81% <81.81%> (ø)
... and 23 files with indirect coverage changes

@chrispader chrispader changed the title [WIP] Fix not-found page after clearing cache Fix not-found page after clearing cache Sep 10, 2026
@garrettmknight
garrettmknight removed their request for review September 14, 2026 11:56
Comment thread src/libs/actions/App.ts Resolved
Comment thread src/libs/actions/App.ts Resolved
@chrispader

chrispader commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor Author

@NicolasBonet i've addressed both of your review comments! Waiting for review by @abdulrahuman5196 🙌🏼

@chrispader

Copy link
Copy Markdown
Contributor Author

@chrispader Seems the fix is fine, I tried to inject onyx changes in dev to trigger the migrated user path and i was able to repro the issue in the main and your pr fixed it.

But how do we create account like this for real? Sign in with an account that is eligible for the migrated-user welcome flow and has already dismissed that welcome modal. So that we can verify the welcome flow since that flow is also had considerable changes.

Thanks, @abdulrahuman5196 . Your test was the right way to verify this fix: you reproduced the migrated-user path on main with controlled Onyx state and confirmed that this PR fixes it.

The welcome flow still exists, but Applause cannot create the required migration-cohort and dismissed-modal state using its release builds and test accounts. A cache reset on an arbitrary account would not verify this bug.

Your verification is sufficient, so I’ve marked the PR [No QA] and removed the QA steps. Any further manual testing of this path would need a C+ reviewer or Expensify engineer with a suitable account.

@NicolasBonet all yours 🙌🏼

@NicolasBonet NicolasBonet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abdulrahuman5196 please complete the checklist including the video

@NicolasBonet

Copy link
Copy Markdown
Contributor

@abdulrahuman5196 please take care of this.

@abdulrahuman5196

Copy link
Copy Markdown
Contributor

Hi, Will close it out today.

@abdulrahuman5196

abdulrahuman5196 commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
androidHybrid-0-Screen_Recording_2026-10-01_at_10.51.30.PM.mov
Android: mWeb Chrome
androidMWeb-0-Screen_Recording_2026-10-01_at_10.54.21.PM.mov
iOS: HybridApp
iosHybrid-0-Screen_Recording_2026-10-01_at_10.31.55.PM.mov
iOS: mWeb Safari
iosMWeb-0-Screen_Recording_2026-10-01_at_10.35.16.PM.mov
MacOS: Chrome / Safari
macOS-0-Screen_Recording_2026-10-01_at_10.25.55.PM.mov

@abdulrahuman5196

Copy link
Copy Markdown
Contributor

No QA. The migrated-user welcome flow requires migration-cohort account state that Applause cannot provision in a release build. Manual verification is limited to the C+ reviewer and an Expensify engineer.

@chrispader I don't think we should mark the pr as No QA due to this condition. We can add steps to verify the normal Clear cache and restart flow. Kindly update the pr author checklist on this.

@abdulrahuman5196 abdulrahuman5196 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes looks good and works well. Reviewers checklist is also complete.

All yours.

🎀 👀 🎀
C+ Reviewed

@melvin-bot
melvin-bot Bot requested a review from NicolasBonet October 1, 2026 17:31
@chrispader chrispader changed the title [No QA] Fix not-found page after clearing cache Fix not-found page after clearing cache Oct 1, 2026
@chrispader

Copy link
Copy Markdown
Contributor Author

Chris's AI wingmate on PR duty. 🤖

Thanks, @abdulrahuman5196. I updated the QA steps so Applause can verify the normal Clear cache and restart flow with any staging account, including an offline reset. I also removed [No QA] and kept the author checklist checked.

Your controlled Onyx reproduction already verified the migrated-user welcome path on main and this PR. That account state is not a prerequisite for the release-build QA steps. The PR is ready for review.

@chrispader

Copy link
Copy Markdown
Contributor Author

@NicolasBonet this is ready to be merged! 🙌🏼

@NicolasBonet

Copy link
Copy Markdown
Contributor

@abdulrahuman5196 please review your checklist: "You completed 43 out of 48 checklist items with 0 unfinished items"

@abdulrahuman5196

Copy link
Copy Markdown
Contributor

pr checklist have been updated

@abdulrahuman5196 abdulrahuman5196 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes looks good and works well. Reviewers checklist is also complete.

All yours.

🎀 👀 🎀
C+ Reviewed

@melvin-bot
melvin-bot Bot requested a review from NicolasBonet October 2, 2026 13:48
@NicolasBonet
NicolasBonet merged commit 836c029 into Expensify:main Oct 2, 2026
38 of 46 checks passed
@OSBotify

OSBotify commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

🚧 NicolasBonet has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify OSBotify mentioned this pull request Oct 4, 2026
59 tasks done
@OSBotify

OSBotify commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/NicolasBonet in version: 9.5.2-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor

No help site update is needed. This PR fixes a bug: after you select Clear cache and restart in Account > Troubleshoot, the app now returns to Troubleshoot instead of showing a not-found page, which is what users already expect.


view run

@IuliiaHerets

Copy link
Copy Markdown

Hi @chrispader. QA team failed this PR on Android with the original issue, welcome module appears after clearing the cache

1791174688920.100859-Android-Fail.mp4

cc @NicolasBonet @abdulrahuman5196

@OSBotify

OSBotify commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/Julesssss in version: 9.5.2-4 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

@chrispader

Copy link
Copy Markdown
Contributor Author

Fix stale AI promo navigation after clearing cache #102983

@IuliiaHerets @NicolasBonet working on this in #102983

@chrispader

Copy link
Copy Markdown
Contributor Author

Hi @chrispader. QA team failed this PR on Android with the original issue, welcome module appears after clearing the cache

@IuliiaHerets @NicolasBonet The AI features promo modal has been removed in #104177, so this issue is resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants