[PR #31] [MERGED] Adjust PWA stuff to detect stale versions #4404

Closed
opened 2026-10-22 04:07:18 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/31
Author: @amauragis
Created: 3/27/2026
Status: ✅ Merged
Merged: 3/29/2026
Merged by: @SpicyMarinara

Base: main ← Head: pwa-trouble


📝 Commits (3)

  • 2ccca56 feat: implement service worker registration and version recovery mechanism to stop stale versions on ios pwa
  • c951df6 Merge branch 'SpicyMarinara:main' into pwa-trouble
  • a820b81 Merge branch 'main' into pwa-trouble

📊 Changes

7 files changed (+140 additions, -4 deletions)

View changed files

📝 packages/client/package.json (+1 -0)
📝 packages/client/src/App.tsx (+86 -0)
📝 packages/client/src/main.tsx (+17 -0)
📝 packages/client/tsconfig.json (+1 -0)
📝 packages/client/vite.config.ts (+3 -3)
📝 packages/server/src/app.ts (+29 -1)
📝 pnpm-lock.yaml (+3 -0)

📄 Description

Client-side version management and service worker enhancements:

  • Added a periodic version check in App.tsx that polls the server for the current version and, if a mismatch is detected, unregisters service workers, clears caches, and reloads the page with a version parameter to ensure users are always on the latest version. [1] [2]
  • Integrated workbox-window and improved service worker registration using virtual:pwa-register, enabling immediate updates and periodic service worker refreshes every minute. [1] [2] [3]
  • Updated TypeScript configuration to include types for the PWA plugin.

Service worker and PWA configuration:

  • Modified the Vite PWA plugin configuration to disable automatic injection of the register script, fine-tune navigation fallback behavior, and adjust glob patterns for cached assets.

Server-side cache control improvements:

  • Enhanced server static file handling to set strict cache control headers: disables caching for index.html and manifest/service worker files, and enables long-term immutable caching for hashed asset files, reducing the risk of clients loading outdated files. Also applies no-cache headers to SPA fallbacks. [1] [2]

Dependency updates:

  • Added workbox-window to dependencies and updated the lockfile. [1] [2]

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/31 **Author:** [@amauragis](https://github.com/amauragis) **Created:** 3/27/2026 **Status:** ✅ Merged **Merged:** 3/29/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `main` ← **Head:** `pwa-trouble` --- ### 📝 Commits (3) - [`2ccca56`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2ccca56c9d3c353f325e45e7cfc00d9a5cbf0a45) feat: implement service worker registration and version recovery mechanism to stop stale versions on ios pwa - [`c951df6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c951df6681e74493724434c1db3d55d7f8042220) Merge branch 'SpicyMarinara:main' into pwa-trouble - [`a820b81`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a820b815d9303832278da773b56fe3432fa2cc0c) Merge branch 'main' into pwa-trouble ### 📊 Changes **7 files changed** (+140 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/package.json` (+1 -0) 📝 `packages/client/src/App.tsx` (+86 -0) 📝 `packages/client/src/main.tsx` (+17 -0) 📝 `packages/client/tsconfig.json` (+1 -0) 📝 `packages/client/vite.config.ts` (+3 -3) 📝 `packages/server/src/app.ts` (+29 -1) 📝 `pnpm-lock.yaml` (+3 -0) </details> ### 📄 Description **Client-side version management and service worker enhancements:** - Added a periodic version check in `App.tsx` that polls the server for the current version and, if a mismatch is detected, unregisters service workers, clears caches, and reloads the page with a version parameter to ensure users are always on the latest version. [[1]](diffhunk://#diff-ec2dc392bcf26c2a7c1a34631db8a5f5d220596d2e986f8959acaa22494fcb78R6-R44) [[2]](diffhunk://#diff-ec2dc392bcf26c2a7c1a34631db8a5f5d220596d2e986f8959acaa22494fcb78R70-R123) - Integrated `workbox-window` and improved service worker registration using `virtual:pwa-register`, enabling immediate updates and periodic service worker refreshes every minute. [[1]](diffhunk://#diff-26d3d28d31824ef26252df77cca08d24faea8451cb8fd3ffee2000f9e496daa0R25) [[2]](diffhunk://#diff-55c6c039ae49c060a9afaafd14a69606e13fdc858da28910fce0fd8f9f113e81R4) [[3]](diffhunk://#diff-55c6c039ae49c060a9afaafd14a69606e13fdc858da28910fce0fd8f9f113e81R22-R37) - Updated TypeScript configuration to include types for the PWA plugin. **Service worker and PWA configuration:** - Modified the Vite PWA plugin configuration to disable automatic injection of the register script, fine-tune navigation fallback behavior, and adjust glob patterns for cached assets. **Server-side cache control improvements:** - Enhanced server static file handling to set strict cache control headers: disables caching for `index.html` and manifest/service worker files, and enables long-term immutable caching for hashed asset files, reducing the risk of clients loading outdated files. Also applies no-cache headers to SPA fallbacks. [[1]](diffhunk://#diff-b4bf798ca8820447b50fa3dd7cb2ab33ba486b016686ce4f98d28cb3df65b0aeL21-R26) [[2]](diffhunk://#diff-b4bf798ca8820447b50fa3dd7cb2ab33ba486b016686ce4f98d28cb3df65b0aeR84-R112) **Dependency updates:** - Added `workbox-window` to dependencies and updated the lockfile. [[1]](diffhunk://#diff-26d3d28d31824ef26252df77cca08d24faea8451cb8fd3ffee2000f9e496daa0R25) [[2]](diffhunk://#diff-32824c984905bb02bc7ffcef96a77addd1f1602cff71a11fbbfdd7f53ee026bbR56-R58) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:07:18 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4404
No description provided.