Repository navigation
Description
If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.
Version Number: v9.4.72-2
Reproducible in staging?: Yes
Reproducible in production?: Unable to validate in Prod - Provide reasoning.
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/72388031/folder/52723991/132279183/1726842303?sort=%2Bidentifier
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: Windows 10
App Component: User Settings
Action Performed:
- Open the browser Developer Tools console
- Execute the command Onyx.set('updateRequired', true) to simulate an application update requirement
- Click the Refresh page button
- Verify the page reloads and the application boots normally
Result: the Refresh page button is unresponsive when clicked, and the page does not reload.
Expected Result:
The page should reload successfully, and the application should boot normally.
Actual Result:
Fail last step. The Refresh page button is unresponsive when clicked, and the page does not reload.
Workaround:
Unknown
Platforms:
- Android: App
- Android: mWeb Chrome
- iOS: App
- iOS: mWeb Safari
- iOS: mWeb Chrome
- Windows: Chrome
- MacOS: Chrome Safari
Screenshots/Videos
Bug7251503_1788552565348.bandicam_2026-09-04_14-59-16-762.mp4
Applause Internal Information
Exported by: Svetlana Lazutkina
Bug ID: 7251503
Issue Owner
Current Issue Owner: @mallenexpensifyMetadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsCRITICAL
Activity
applause-bot commentedon Sep 4, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/6269ba5f2673c08aaaa35a179d948c70b8efaee24a292db5ad589d4febd2b63f
MelvinBot commentedon Sep 4, 2026
Proposal
What is the root cause of that problem?
The Refresh page button never reloads because the reload is gated behind a promise that has no
.catch()and no.finally().src/libs/actions/AppUpdate/updateApp/index.ts:9:window.location.reload()runs only ifclearWorkboxRecoveryCaches()fulfills. If it rejects or never settles, the button is a silent no-op — no reload, no error, no feedback. That is exactly the reported symptom.This is a regression from #95438 (merged 2026-07-07, labelled
[No QA]), which changed that line from an unconditionalwindow.location.reload().The comparison that pins it: the other error-page refresh button renders the same
ButtonComposedin the same ErrorBoundary tree and works, becauseusePageRefreshcallswindow.location.reload()directly for everything except chunk-load errors. The cache-clearing gate is the only difference between "refresh works" and "refresh does nothing".Why the promise can fail to settle on staging/production:
clearWorkboxRecoveryCachesdeletes every Cache Storage entry and only afterwards unregisters the service workers. The workbox service worker is registered on staging too —CONFIG.ts:102definesIS_IN_PRODUCTIONasprocess.env.NODE_ENV === 'production', which is true for staging builds (platformSetup/index.ts:77-86). So a click wipes the precache that the still-controlling service worker needs, before that worker is unregistered.What changes do you think we should make in order to solve the problem?
Make cache clearing best-effort so it can never block the reload:
updateApp/index.ts, replace.then(...)with a.catch()that logs plus a.finally(() => window.location.reload()), so the reload happens on every outcome.clearWorkboxRecoveryCaches()against a short timeout (~2s) so a hung Cache Storage orgetRegistrations()call cannot strand the user on a dead button.usePageRefresh/index.ts:29, which has the identical unguarded.then(reload).Steps 1 and 2 alone restore the button in every case, including ones we have not reproduced.
What alternative solutions did you explore? (Optional)
window.location.reload(). That fixes the button but reintroduces the stale-bundle problem that PR was solving.Investigation details — hypotheses ruled out, and confidence
Ruled out — the click is blocked by an overlay.
Expensify.tsx:293-295throwsCONST.ERROR.UPDATE_REQUIRED, andBaseErrorBoundary.tsx:27-28callsBootSplash.hide()on the line before it sets the error content — so the splash is always gone by the time the view renders, and the splash is an opaque green full-viewport element anyway (web/index.html:130-145), which the tester would have seen. No other full-screen element survives the throw.Ruled out —
ButtonComposeddropsonPress. TracedButton.tsx:170-186→PressableWithFeedback→BaseGenericPressable.tsx:204;onPressreaches the handler,isDisabled/isLoadingdefault tofalse,pointerEventsNoneis applied only to the labelText, and the same component powers the workingGenericErrorPagerefresh button.Ruled out — the state survives the reload.
updateRequiredisONYXKEYS.RAM_ONLY_UPDATE_REQUIRED(ONYXKEYS.ts:604) and is registered inramOnlyKeysatsrc/setup/index.ts:77. Onyx never persists or rehydrates those, so a real reload always clears it.Ruled out —
Platform.OS !== 'web'short-circuit.react-nativeis aliased toreact-native-webin the web build, soPlatform.OS === 'web'. And even if it returned early, the function isasync, so.then(reload)would still fire. That guard can never suppress the reload.Adjacent bug worth a separate issue:
UpdateAppModal.tsx:22-32wires the "update available" confirm button tohandleClose, so it just dismisses the modal and never callsupdateApp. That leavesUpdateRequiredViewas the only caller ofupdateAppanywhere in the app.Confidence: medium-high. The defect is a code fact and the regression is pinned to a specific PR. Which failure mode fires at runtime (a hang versus a rejection) is not confirmed — an automated web repro was attempted but the repro needs DevTools console execution, which the browser automation cannot do. To confirm on staging, open DevTools, run the repro, click the button, and check whether
[SW] Failed to clear Cache Storage during app resetor an unhandled promise rejection appears. The recommended fix is correct either way.Related issues: a scan of open
Expensify/Appissues for this symptom found no duplicate.💡 Suggested AI code review rule
This looks like a recurring, mechanically detectable pattern, so it may be worth a coding-standards rule so the AI reviewer catches the next one. Proposed for
Expensify/App:CONSISTENCY-19— Never gate a required side effect on a best-effort promisewindow.location.reload(), sign-out, navigation, closing a modal) is invoked only inside.then()of a cleanup or telemetry promise with no.catch()and no.finally(). Move the action into.finally(), and time-box the cleanup.\.then\(\s*\(\)\s*=>\s*(window\.location\.reload|Navigation\.|Session\.signOut)where the same statement contains neither.catch(nor.finally(updateApp/index.ts:9andusePageRefresh/index.ts:29CONSISTENCY-6(Ensure proper error handling) is adjacent but covers unreported errors, not the primary action never running. AmendingCONSISTENCY-6instead of adding a new rule is a reasonable call.The full rule file, with the ❌/✅ code inline in App's coding-standards format, would live in
Expensify/Appitself. If it's worth adding, a maintainer can open it there as a draft PR.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/100437)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run · no recording available
melvin-bot commentedon Sep 4, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @bernhardoj (
External)melvin-bot commentedon Sep 4, 2026
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
bernhardoj commentedon Sep 6, 2026
@MelvinBot I'm able to repro it on staging, but never on dev. Do you know why?
Also, there is no error. It's just
clearWorkboxRecoveryCachestaking longer to resolve after being used more than once.MelvinBot commentedon Sep 6, 2026
Dev never has a service worker, so there is nothing for
clearWorkboxRecoveryCachesto wait on. On staging there is one, and the twoawaits in that function get queued behind Workbox's precache install — which restarts from zero on every refresh because the previous click just deleted the precache. Hence: no error, just an ever-growing wait.Why dev is immune
GenerateSWis only added to the build for non-dev env files (config/rsbuild/rsbuild.common.ts:494-497), and registration is gated onConfig.IS_IN_PRODUCTION(platformSetup/index.ts:77-86). Staging builds setNODE_ENV=production, so staging gets the worker; dev gets neither the file nor the registration.So on dev,
clearWorkboxRecoveryCacheshitscaches.keys()→ only the tinyCacheAPIentries, andgetRegistrations()→[]. Both resolve in single-digit ms and the reload always fires.Why it degrades on staging with repeated use
The precache is deliberately huge — vendor ~6.5 MiB, main ~5.5 MiB,
authScreens.prefetch~6.3 MiB,canvaskit.wasm~7.6 MiB, all precached withmaximumFileSizeToCacheInBytes: 10 MiB. The loop is:workbox-precache-v2-*→ unregister → reload.platformSetupregisters/service-worker.jsagain. WithskipWaiting: true+clientsClaim: trueit activates and claims the page immediately, whilecache.addAll()is still writing ~25 MB back from the network.caches.delete(name)queues behind every in-flightputon that cache.registration.unregister()queues behind the in-progress install job for the same scope (the SW job queue is per-scope FIFO).Each click wipes the precache, so step 2 is a full cold re-fetch every time — and clicking again before it settles lengthens the queue rather than resetting it. Nothing rejects, so nothing logs.
What this changes about the fix
The
.catch()half of my earlier proposal is not the point — a timeout is. Concretely, inupdateApp/index.ts:9andusePageRefresh/index.ts:29:Promise.race([clearWorkboxRecoveryCaches(), timeout(~1500ms)]).finally(() => window.location.reload())— the reload must never be gated on cleanup finishing.clearWorkboxRecoveryCaches, unregister before deleting caches. Unregistering is the part that actually breaks the stale-shell loop; deleting the precache first is what creates the re-download that makes the next call slow. Workbox already prunes outdated precache entries on install, so the blanketcaches.deleteis mostly redundant here.Confirming which await is the slow one
I could not instrument this directly — the mechanism is derived from the build config and the SW/CacheStorage queueing model, not from a staging trace. If you want to pin it, run this on staging before clicking Refresh the second time:
If
deldominates it's CacheStorage contention; ifunregdominates it's the SW job queue. The fix above covers both.view run · view recording
bernhardoj commentedon Sep 6, 2026
@lanitochka17 can you retest this and wait for 30s-1m or more after pressing the "Refresh page" and see if the page is refreshed? From my testing, it just takes long.
lanitochka17 commentedon Sep 7, 2026
@bernhardoj It`s working after 30 seconds
bandicam.2026-09-07.08-34-31-146.mp4
bernhardoj commentedon Sep 8, 2026
Thanks @lanitochka17
I can reproduce this on staging, but can't on the local build. The "refresh page" does 2 thing: clears the caches and unregisters the service worker. Not sure which one is slow.
@Expensify/design should we show a loading indicator on the button?
dannymcclain commentedon Sep 8, 2026
Are you suggesting we put a loading spinner on this button until it is ready to click?
How long would someone be waiting there? Would it be like 30s? It doesn't seem like a great experience to be dropped on an update screen with nothing to do but wait. Any chance we can work to figure out what's slowing things down?
42 remaining items
melvin-bot commentedon Nov 7, 2026
[-]w36-Settings- Refresh page button is unresponsive[/-][+][Due for payment 2026-11-14] w36-Settings- Refresh page button is unresponsive[/+]melvin-bot commentedon Nov 7, 2026
@bernhardoj
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.5.33-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2026-11-14. 🎊
The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]
melvin-bot commentedon Nov 10, 2026
@bernhardoj Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
melvin-bot commentedon Nov 12, 2026
@bernhardoj Huh... This is 4 days overdue. Who can take care of this?
melvin-bot commentedon Nov 13, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Nov 13, 2026
Payment Summary
Resolving PRs:
Fix web update refresh delays with network-first navigation #104520
Reviewer: @bernhardoj owed $175 via NewDot
BugZero Checklist (@mallenexpensify)
bernhardoj commentedon Nov 14, 2026
Contributor+ Checklist:
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR: https://github.com/Expensify/App/pull/95438/changes#r4572566924
Link to the comment on the Issue: N/A - E/E issue
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
This is caught by an existing test case, so no need for a new one.