- Fix DOMPurify SSR crash (use isomorphic-dompurify) - Fix SanitizedHtml to sanitize by default - Add auth guards to studio/catalog maintenance pages - Add update/edit to vouchers CRUD - Add update/edit to rare-values CRUD - Add approve workflow to applications page - Add edit form to guilds detail page - Add SEO metadata to all public pages (21 pages) - Fix mobile nav accessibility (focus trap, aria attributes) - Fix missing labels and table accessibility - Add dynamic imports for heavy client components (6 components) - Fix silent error swallowing (40+ locations) - Add content scheduling for articles (publishAt, status) - Wire up 12 missing webhook notification triggers - Add global search to admin panel - Add bulk actions to admin users table - Fix JSON formatting and a11y issues
26 lines
525 B
TypeScript
26 lines
525 B
TypeScript
"use client";
|
|
|
|
import { useEffect } from "react";
|
|
|
|
const SW_VERSION = "3";
|
|
|
|
export function PwaRegister() {
|
|
useEffect(() => {
|
|
if (typeof navigator === "undefined" || !("serviceWorker" in navigator))
|
|
return;
|
|
|
|
navigator.serviceWorker.getRegistrations().then((regs) => {
|
|
for (const reg of regs) {
|
|
reg.unregister();
|
|
}
|
|
});
|
|
|
|
navigator.serviceWorker
|
|
.register(`/sw.js?${SW_VERSION}`)
|
|
.catch((error) =>
|
|
console.error("[PWA] Service worker registration failed:", error),
|
|
);
|
|
}, []);
|
|
return null;
|
|
}
|