Fix React hydration mismatch and clean up stale service workers

- Pin formatDate to timeZone: 'UTC' so server and client produce
  identical date strings (fixes React error #418)
- Add one-shot service worker unregistration since SpiceBook doesn't
  use one — clears phantom registrations from browser cache
This commit is contained in:
Ryan Malloy 2026-02-20 16:07:42 -07:00
parent 3ee3cd6d8a
commit 72cfd8191a
2 changed files with 9 additions and 0 deletions

View File

@ -13,6 +13,7 @@ function formatDate(iso: string): string {
month: 'short', month: 'short',
day: 'numeric', day: 'numeric',
year: 'numeric', year: 'numeric',
timeZone: 'UTC',
}); });
} catch { } catch {
return iso; return iso;

View File

@ -51,6 +51,14 @@ const canonicalUrl = canonicalPath
</head> </head>
<body class="bg-slate-950 text-slate-200 min-h-screen antialiased"> <body class="bg-slate-950 text-slate-200 min-h-screen antialiased">
<slot /> <slot />
<script>
// Clean up stale service workers — SpiceBook doesn't use one
if ('serviceWorker' in navigator) {
navigator.serviceWorker.getRegistrations().then((regs) => {
for (const reg of regs) reg.unregister();
});
}
</script>
</body> </body>
</html> </html>