Fix blank page + chunk load errors after deploys#346
Open
HarmlessHarm wants to merge 3 commits into
Open
Conversation
…sset 400 page (#264) - Remove skipWaiting so a new service worker installs in the background and waits instead of purging the precache under a running session - Check for updates on tab focus; activate the waiting worker on the next page load via SKIP_WAITING + one controllerchange reload - Remove the delete-all-caches updated() handler (deleted the new precache too) and the dead custom-service-worker.js (ignored under GenerateSW) - Reload once on ChunkLoadError via router.onError, with a 30s guard against reload loops - Answer requests for missing static assets with a 400 + friendly reload page instead of SSR HTML, which caused 'Unexpected token <'
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Fixes issue #264: returning users experiencing blank pages with "Unexpected token '<'" errors after deploys. The root cause is a service worker update race condition where a new SW activates mid-page-load and purges the old precache while the page is still loading old chunks, causing asset requests to fall through to SSR and return HTML instead of JavaScript.
Changes
Service Worker Update Strategy (
quasar.conf.js,src-pwa/register-service-worker.js)skipWaiting: truefrom workbox options so new SWs install in the waiting state instead of activating immediately under a live pageupdated()handler that was clearing all caches (including the new precache)updatefound()→registration.update()callcontrollerchangelistener to reload once when a waiting SW takes control (happens at page-load time)SKIP_WAITINGto activate it immediately while the page is barely startedRemoved Dead Code (
src-pwa/custom-service-worker.js)InjectManifestmode but the app usesGenerateSW, so it was never activeChunk Load Safety Net (
src/router/index.js)Friendly Missing Asset Response (
src-ssr/index.js)Result
https://claude.ai/code/session_01JZmaRYSXLRX3USEf7oMoGH