From 7f38444707c2d6684a9e82dbb3448fe36477dbe4 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 29 Oct 2026 12:52:50 -0700 Subject: [PATCH] Update host dir and release process --- client/vite.config.js | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/client/vite.config.js b/client/vite.config.js index b2b13fd..65f8a20 100644 --- a/client/vite.config.js +++ b/client/vite.config.js @@ -66,13 +66,29 @@ export default defineConfig({ // mid-session underneath them. clientsClaim: false, skipWaiting: false, - runtimeCaching: [ - { - urlPattern: ({ url }) => - url.pathname.startsWith('/api/') || url.pathname.startsWith('/socket'), - handler: 'NetworkOnly', - }, - ], + // + // runtimeCaching is deliberately EMPTY. Do not add an entry for /api/* + // or /socket -- not even NetworkOnly. + // + // There used to be a NetworkOnly route for both, as belt-and-braces for + // the invariant above. It was worse than useless. registerRoute() makes + // the worker call event.respondWith() for every matching request, and + // Socket.IO's long-poll requests are aborted as a matter of course -- + // on reconnect, on transport upgrade, and whenever Android backgrounds + // the page. An aborted fetch inside NetworkOnly throws Workbox's + // `no-response`, the respondWith promise rejects, and Socket.IO sees a + // dead transport and reconnects. The installed PWA was dropping its + // live note sync on a loop and filling the logs with + // "FetchEvent ... resulted in a network error response". + // + // With no route registered the worker never intercepts these at all and + // the browser handles them natively, exactly as in a normal tab. + // + // Nothing is lost on the security side: the invariant is enforced by + // globPatterns only ever reading dist/, and by there being no *caching* + // strategy here. NetworkOnly enforced nothing -- it only inserted the + // worker into the hot path of every poll. + // }, // Flip to true temporarily to exercise the worker on the dev server. // Remember to unregister it afterwards -- a lingering dev service worker