Skip to content

fix(pwa): remove broken navigateFallback breaking SSR page refresh - #1071

Merged
sanaderi merged 1 commit into
GamaEdtech:upgrade-v4from
gamadev1:fix/pwa-sw-navigate-fallback-precache
Jul 22, 2026
Merged

fix(pwa): remove broken navigateFallback breaking SSR page refresh#1071
sanaderi merged 1 commit into
GamaEdtech:upgrade-v4from
gamadev1:fix/pwa-sw-navigate-fallback-precache

Conversation

@gamadev1

Copy link
Copy Markdown
Collaborator

Summary

  • On gamatrain.com, refreshing a page (outside incognito) throws Uncaught (in promise) non-precached-url: non-precached-url :: [{"url":"/"}] from the generated Workbox service worker, and subsequent client-side API calls fail to fire correctly.
  • Root cause: nuxt.config.js's pwa.workbox.navigateFallback: '/' tells the SW to intercept every navigation and serve a precached copy of /, but globPatterns: [] means nothing — including / — is ever precached. Once a service worker from a prior visit controls the page, every refresh hits this broken fallback instead of loading normally.
  • Confirmed: reproduces only in a normal browsing session (where the old SW is still registered and controlling the page); works fine in incognito (no prior SW registration).
  • Fix: remove the broken navigateFallback entry. Precaching was already effectively disabled (globPatterns: []), so this doesn't reduce any working offline functionality — it just removes the dangling reference that throws.
  • Also fixes an unrelated pre-existing lint error ($toast destructured but unused in app/pages/admin/schools/contributions/index.vue) that was blocking the pre-commit hook.

Test plan

  • npx eslint passes on both changed files (verified locally)
  • Deploy preview / production and confirm no non-precached-url console error on refresh in a normal (non-incognito) browser session
  • Confirm page data/APIs load correctly on hard refresh across a few routes (e.g. /paper/[id]/[slug])

globPatterns is empty (no assets precached), so navigateFallback: '/'
made the generated service worker throw workbox-precaching's
"non-precached-url" error on every navigation once the SW controlled
the page. That intercepted page refreshes and broke subsequent API
calls in production. Confirmed via console error on gamatrain.com and
by reproducing only outside incognito (where the SW persists).

Also removes an unused $toast destructure in the admin school
contributions page that was blocking the pre-commit lint hook.
@vercel

vercel Bot commented Jul 22, 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.

@sanaderi
sanaderi merged commit ccb097b into GamaEdtech:upgrade-v4 Jul 22, 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