Refresh HiveGrid Cloud reference snapshot

This commit is contained in:
david committed 2026-08-03 15:31:14 +02:00
1 parent 5e99e14772
commit 7f88026f79
5955 files changed
+1177325 -188362

No files matched your search

@@ -11,6 +11,10 @@
*
* Refs: docs/improvement-plan/10-compliance-polish/lighthouse.md (Step (d)).
*/
import { SERVICE_WORKER_VERSION } from "./serviceWorkerRecoveryBootstrap";
export const SERVICE_WORKER_SCRIPT_URL = `/sw.js?v=${encodeURIComponent(SERVICE_WORKER_VERSION)}`;
export type RegisterServiceWorkerOptions = {
scriptUrl?: string;
scope?: string;
@@ -18,6 +22,8 @@ export type RegisterServiceWorkerOptions = {
navigatorRef?: Navigator;
/** Inject an override container so tests can disable DEV gating. */
isDev?: boolean;
/** Optional client-side telemetry hook; registration failure remains non-fatal. */
onError?: (error: unknown) => void;
};
export async function registerServiceWorker(options: RegisterServiceWorkerOptions = {}): Promise<ServiceWorkerRegistration | null> {
@@ -31,14 +37,11 @@ export async function registerServiceWorker(options: RegisterServiceWorkerOption
}
try {
return await navigatorRef.serviceWorker.register(options.scriptUrl ?? "/sw.js", {
return await navigatorRef.serviceWorker.register(options.scriptUrl ?? SERVICE_WORKER_SCRIPT_URL, {
scope: options.scope ?? "/",
});
} catch (err) {
// Swallow but log — a failed SW must never break the app render.
if (typeof console !== "undefined") {
console.warn("[pwa] service worker registration failed", err);
}
options.onError?.(err);
return null;
}
}