Fix service worker TypeError on localhost; inline edit config timing
sw.js: Remove fetch event interception entirely. The passthrough e.respondWith(fetch(request)) call was throwing TypeError on localhost HTTPS due to certificate trust differences in the SW context, causing JS/CSS resource loads to fail. The SW exists for PWA installability only — no interception is needed to satisfy that requirement. inline-item-edit.js: Move window.inlineItemEdit config read inside DOMContentLoaded so script load order vs. config assignment in @section Scripts doesn't matter. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -12,15 +12,7 @@ const SKIP_PREFIXES = ['/hubs/', '/Kiosk/PollSession'];
|
||||
self.addEventListener('install', () => self.skipWaiting());
|
||||
self.addEventListener('activate', e => e.waitUntil(self.clients.claim()));
|
||||
|
||||
self.addEventListener('fetch', e => {
|
||||
const url = new URL(e.request.url);
|
||||
|
||||
// Always skip cross-origin requests
|
||||
if (url.origin !== self.location.origin) return;
|
||||
|
||||
// Skip SignalR hubs and kiosk polling — let the browser handle these directly
|
||||
if (SKIP_PREFIXES.some(p => url.pathname.startsWith(p))) return;
|
||||
|
||||
// Passthrough: no caching, no modification
|
||||
e.respondWith(fetch(e.request));
|
||||
});
|
||||
// No fetch interception — all requests handled natively by the browser.
|
||||
// The SW exists solely for PWA installability; calling e.respondWith(fetch(request))
|
||||
// causes TypeError failures on localhost HTTPS due to certificate trust differences
|
||||
// in the SW context, breaking JS/CSS resource loads.
|
||||
|
||||
Reference in New Issue
Block a user