Files
PowderCoatingLogix/src/PowderCoating.Web/wwwroot/sw.js
T
spouliot 30c644a8ec 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>
2026-05-20 22:48:31 -04:00

19 lines
996 B
JavaScript

// Minimal service worker — required for PWA installability.
// No caching: all requests pass through to the network.
// Exists solely so browsers recognize the site as installable
// (iOS/Android persist camera permissions after "Add to Home Screen").
//
// IMPORTANT: /hubs/ (SignalR) requests are excluded from interception entirely.
// Service worker fetch() wraps SSE/WebSocket responses in a buffered Response,
// which prevents real-time streaming — SignalR handshakes time out as a result.
const SKIP_PREFIXES = ['/hubs/', '/Kiosk/PollSession'];
self.addEventListener('install', () => self.skipWaiting());
self.addEventListener('activate', e => e.waitUntil(self.clients.claim()));
// 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.