Skip to content

fix(pwa): keep the service worker from being cached - #2664

Merged
dargmuesli merged 2 commits into
mainfrom
fix/pwa/worker-cache
Nov 17, 2026
Merged

dargmuesli merged 2 commits into
mainfrom
fix/pwa/worker-cache

Conversation

@dargmuesli

@dargmuesli dargmuesli commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Since the update to @vite-pwa/nuxt 2 in #2650, /sw.js is served without a Cache-Control header. Version 1 added public, max-age=0, must-revalidate for the worker while Nitro was being configured. Version 2 adds it only after Nitro is set up, and with experimental.inlineRouteRules, Nuxt then rebuilds the route rules from the original configuration and drops it. Without the header, a CDN caches the worker like any other script and keeps serving the previous build's worker after a deploy. That worker precaches the previous build's chunks, most of which no longer exist, so its install fails on the 404s and the browser drops the registration. The app then runs without a service worker until the cached copy expires, which also leaves navigator.serviceWorker.ready pending, so showing notifications waits forever.

This adds the header for /sw.js as an explicit route rule, so caches revalidate the worker on every request again. A production build of this branch serves /sw.js with the header. The upstream fix is vite-pwa/nuxt#241, and a TODO marks this rule for removal once it is released.

The copy of /sw.js that is already cached in front of production stays until it expires or is purged.

@dargmuesli
dargmuesli enabled auto-merge (squash) November 17, 2026 17:32
@dargmuesli
dargmuesli merged commit 3e23d06 into main Nov 17, 2026
11 checks passed
@dargmuesli
dargmuesli deleted the fix/pwa/worker-cache branch November 17, 2026 17:39
maevsi-bot pushed a commit that referenced this pull request Nov 17, 2026
## [17.12.4](17.12.3...17.12.4) (2026-11-17)

### Bug Fixes

* **email:** align the dark mode colors with the design system ([#2663](#2663)) ([12057f8](12057f8))
* **event:** confirm external description links ([#2667](#2667)) ([b9c4657](b9c4657))
* **notification:** follow permission changes made outside the app ([#2665](#2665)) ([6f82915](6f82915))
* **pwa:** keep the service worker from being cached ([#2664](#2664)) ([3e23d06](3e23d06))
* **pwa:** match the dark theme color to the surface token ([#2662](#2662)) ([da662cb](da662cb))
@maevsi-bot

Copy link
Copy Markdown

🎉 This PR is included in version 17.12.4 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

maevsi-bot pushed a commit that referenced this pull request Nov 20, 2026
## [18.0.0-beta.7](18.0.0-beta.6...18.0.0-beta.7) (2026-11-20)

### Features

* **account:** add a menu to the profile ([#2736](#2736)) ([7c1a821](7c1a821))
* **account:** edit the profile in one form ([#2731](#2731)) ([4fc1700](4fc1700))
* **account:** load profile pictures through our server ([#2713](#2713)) ([ef3f0be](ef3f0be))
* **account:** move account settings to the account edit page ([#2702](#2702)) ([e3ed30f](e3ed30f))
* **address:** store and show the structured address of event locations ([#2723](#2723)) ([b3c75b1](b3c75b1))
* **consent:** ask for privacy choices in an app-like way ([#2714](#2714)) ([02a1928](02a1928))
* **dashboard:** add header actions and poster hunt tiles ([#2722](#2722)) ([fa0b6ca](fa0b6ca))
* **dashboard:** move poster hunt below top pick and remove app install button ([#2700](#2700)) ([2d4d9d2](2d4d9d2))
* **dashboard:** suggest the ai setup until preferences exist ([#2711](#2711)) ([2d64b73](2d64b73))
* **discover:** lead with a sticky search bar ([#2720](#2720)) ([07159b9](07159b9))
* **early-bird:** adapt the flow to the b4 design ([#2734](#2734)) ([15711d4](15711d4))
* **event:** act on poster hunt choices right away ([#2735](#2735)) ([14e1469](14e1469))
* **event:** add a flagged participation stub ([#2675](#2675)) ([b240cad](b240cad))
* **event:** delete from the event page ([#2708](#2708)) ([95a58ac](95a58ac))
* **event:** fill the event form from a photographed poster ([#2683](#2683)) ([435e599](435e599))
* **event:** move edit to the menu and add an invite action ([#2730](#2730)) ([2f52fd2](2f52fd2))
* **event:** read event pages from links ([#2727](#2727)) ([6c98b91](6c98b91))
* **event:** show distance and guests in list items ([#2724](#2724)) ([4fa7ef6](4fa7ef6))
* **event:** show my events with upcoming, past, hosting and saved views ([#2719](#2719)) ([10334bb](10334bb))
* **event:** take poster photos from the ios app's document camera and share sheet ([#2692](#2692)) ([3f948d9](3f948d9))
* **form:** confirm password protected deletions in a drawer ([#2701](#2701)) ([d03e3df](d03e3df))
* **layout:** give subpages a top bar ([#2654](#2654)) ([61d6c71](61d6c71))
* **layout:** give the contact book and image gallery a top bar ([#2655](#2655)) ([ff76757](ff76757))
* **layout:** link to the settings from the menu ([#2657](#2657)) ([a92d7b1](a92d7b1))
* **map:** align location picking and event map previews with the design ([#2725](#2725)) ([adb8ef3](adb8ef3))
* **map:** ask for consent where the map appears ([#2715](#2715)) ([1e05bcd](1e05bcd))
* **map:** enable ([#2706](#2706)) ([7e19aeb](7e19aeb))
* **map:** require two fingers or ctrl to move the map ([#2705](#2705)) ([b5f57b3](b5f57b3))
* **notification:** ask for notifications during onboarding ([#2710](#2710)) ([7f1a01e](7f1a01e))
* **preference:** adapt the setup flow to the b4 design ([#2726](#2726)) ([b8bbbe9](b8bbbe9))
* **pwa:** show an install card ([#2716](#2716)) ([e5c6445](e5c6445))
* **session:** color the settings menu icons ([#2728](#2728)) ([a60ab83](a60ab83))
* **session:** detail invitation codes ([#2737](#2737)) ([603c97f](603c97f))
* **session:** reorder developer information and clarify notifications ([#2704](#2704)) ([acc6255](acc6255))

### Bug Fixes

* **app:** keep the sign-in page for signed-out app users ([#2693](#2693)) ([4207e86](4207e86))
* **consent:** gate third-party requests and session replay behind consent ([#2695](#2695)) ([c623451](c623451))
* **consent:** lock the page scroll behind the consent screen ([#2729](#2729)) ([220b3e0](220b3e0))
* **deps:** update all non-major dependencies ([d87b653](d87b653))
* **email:** align the dark mode colors with the design system ([#2663](#2663)) ([12057f8](12057f8))
* **email:** align the light mode colors with the design system ([#2670](#2670)) ([e834a17](e834a17))
* **event:** confirm external description links ([#2667](#2667)) ([b9c4657](b9c4657))
* **event:** fetch only public addresses on url ingestion ([#2684](#2684)) ([587ee59](587ee59))
* **event:** hide the guest count when nobody has joined ([#2733](#2733)) ([d5b8d28](d5b8d28))
* **event:** report a missing event as not found ([#2691](#2691)) ([03fdce9](03fdce9))
* **event:** send ingestion fields as nullable to openai ([#2690](#2690)) ([20c21db](20c21db))
* **event:** send the csrf token when reading posters ([#2688](#2688)) ([99d789f](99d789f))
* **guest:** fix check-in code dialog and calendar download ([#2703](#2703)) ([35b0d25](35b0d25))
* **head:** keep the twitter card after hydration ([#2679](#2679)) ([4bbe20d](4bbe20d))
* **imprint:** update legal representatives ([#2699](#2699)) ([9173059](9173059))
* **layout:** offer the create button in the sidebar ([#2653](#2653)) ([100cbd7](100cbd7))
* **legal:** separate terms acceptance from privacy information and fix imprint ([#2696](#2696)) ([9acb501](9acb501))
* **map:** lift the fullscreen map above all stacking contexts ([#2732](#2732)) ([4eca7f6](4eca7f6))
* **navigation:** ask to sign in on owner pages and flag unfinished pages ([#2678](#2678)) ([338f83d](338f83d))
* **navigation:** frame every page the same way ([#2659](#2659)) ([0a0f518](0a0f518))
* **navigation:** go back through the browser history ([#2676](#2676)) ([dacb5f5](dacb5f5))
* **navigation:** polish labels, focus, widths, settings, and unsaved changes ([#2680](#2680)) ([049bd16](049bd16))
* **navigation:** unify the sign-in gate and its back navigation ([#2658](#2658)) ([854f2ad](854f2ad))
* **notification:** follow permission changes made outside the app ([#2665](#2665)) ([6f82915](6f82915))
* **pwa:** keep the service worker from being cached ([#2664](#2664)) ([3e23d06](3e23d06))
* **pwa:** match the dark theme color to the surface token ([#2662](#2662)) ([da662cb](da662cb))
* **sentry:** capture only console errors and warnings ([#2652](#2652)) ([70eaa01](70eaa01))
* **session:** disable the notification permit button when no request is possible ([#2660](#2660)) ([cfb3c61](cfb3c61))
* **session:** require the csrf token to sign out ([#2689](#2689)) ([82bd74a](82bd74a))
* **terms:** describe content moderation and remove invalid clauses ([#2698](#2698)) ([31bafbd](31bafbd))
@maevsi-bot

Copy link
Copy Markdown

🎉 This PR is included in version 18.0.0-beta.7 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants