Skip to content

fix(pwa, hydration): fix Vuetify SSR display mismatch and workbox precache error - #1083

Merged
gamatraindev merged 1 commit into
GamaEdtech:upgrade-v4from
sanaderi:fix/hydration-mismatch-and-sw-precache
Aug 2, 2026
Merged

fix(pwa, hydration): fix Vuetify SSR display mismatch and workbox precache error#1083
gamatraindev merged 1 commit into
GamaEdtech:upgrade-v4from
sanaderi:fix/hydration-mismatch-and-sw-precache

Conversation

@sanaderi

@sanaderi sanaderi commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Production console shows Hydration completed but contains mismatches and a service worker error Uncaught (in promise) non-precached-url :: [{"url":"/"}] (seen on e.g. https://gamatrain.com/paper/39575/Predicted-Paper-Checkpoint-Science0893-Paper-1-for-October-2026-pdf).
  • app/plugins/vuetify.ts created createVuetify() without ssr: true. Vuetify's useDisplay() (used in ~50 components, including the paper/multimedia download buttons) computes viewport width as 0 on the server but reads the real window.innerWidth on the client during hydration, producing mismatched classes/v-if for any non-mobile visitor. Adding ssr: true keeps server/client display state in sync through hydration (Vuetify then corrects it right after, via its own Nuxt app:suspense:resolve hook).
  • nuxt.config.js's pwa.workbox.globPatterns is intentionally [] (SSR app, nothing to precache), but navigateFallback was left unset, so @vite-pwa/nuxt defaulted it to '/'. The generated service worker then called createHandlerBoundToURL('/') for a URL that was never precached, throwing non-precached-url on every load. Explicitly setting navigateFallback: undefined removes that broken navigation-fallback route from the generated sw.js (verified against workbox-build's own SW template, which gates that code behind if (navigateFallback)).

Test plan

  • Deploy to a preview/staging environment and confirm the hydration mismatch warning and non-precached-url service worker error no longer appear on paper/multimedia detail pages
  • Spot-check mobile bottom-sheet download UI still renders correctly after hydration
  • Confirm PWA install/offline behavior is unaffected

🤖 Generated with Claude Code

… precache error

Vuetify's useDisplay() computed width as 0 on the server but read the
real window.innerWidth on the client during hydration, causing mismatched
classes/v-if for any non-mobile visitor across ~50 call sites (paper and
multimedia download UI included). Passing ssr: true lets Vuetify keep
server/client in sync through hydration and correct afterward.

Also, globPatterns: [] left the workbox precache manifest empty while
navigateFallback still defaulted to '/', so the generated service worker
threw "non-precached-url" for '/' on every load. Explicitly unsetting
navigateFallback removes the broken navigation fallback route entirely.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown

@sanaderi is attempting to deploy a commit to the GamaEdtech Team on Vercel.

A member of the Team first needs to authorize it.

@gamatraindev
gamatraindev merged commit 5a0a090 into GamaEdtech:upgrade-v4 Aug 2, 2026
1 of 3 checks passed
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.

2 participants