Skip to content

fix: reload once when a deploy removed the page chunks (2.35.1) - #285

Merged
Sagargupta16 merged 1 commit into
mainfrom
fix/stale-chunk-reload
Nov 2, 2026
Merged

Sagargupta16 merged 1 commit into
mainfrom
fix/stale-chunk-reload

Conversation

@Sagargupta16

Copy link
Copy Markdown
Owner

What and why

After 2.35.0 went live, a tab that was still running 2.34.1 (or the installed app's first launch) asked for OverviewPage-D4KNwQfk.js and got a 404. The service worker updates itself (autoUpdate, clientsClaim) and cleanupOutdatedCaches deletes the previous build's chunks, Pages no longer serves them, and registerSW.js never reloads the page. So the first lazy page opened after a deploy fails.

main.tsx now listens for vite:preloadError and reloads once onto the current build. A second failure within 60 seconds is left to ChunkErrorBoundary's existing "Failed to load page" screen, so it cannot loop.

Diff

  • frontend/src/main.tsx: the handler (14 lines).
  • 2.35.1 in both package.json files, pyproject.toml, __init__.py, uv.lock, api/README.md, docs/API.md and docs/DEPLOYMENT.md; CHANGELOG entry; the PWA note in .claude/rules/frontend.md.

Verified

  • Live: OverviewPage-D4KNwQfk.js answers 404; the live entry index-DJGXTtYH.js loads OverviewPage-BiAkOT1v.js.
  • A GITHUB_PAGES=true production build served with vite preview, the Overview chunk removed from dist and the service worker cleared, then a client-side move to /overview:
    • the page reloaded once, 42 ms after the failed import;
    • the reloaded page failed again (same build), showed "Failed to load page" and did not reload again in 6 seconds;
    • with the chunk restored, the Reload button rendered Overview (chunk 200).
  • eslint, tsc -b and the pre-commit hooks pass.

Not verified

  • The real installed app on a phone after this deploy; the next deploy is the first real test.
  • vite preview answers a missing chunk with the HTML shell (200, text/html) where Pages answers 404. Both reject the dynamic import the same way.

@Sagargupta16
Sagargupta16 merged commit 5089cd7 into main Nov 2, 2026
14 checks passed
@Sagargupta16
Sagargupta16 deleted the fix/stale-chunk-reload branch November 2, 2026 14:52
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.

1 participant