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:
parent
3ee3cd6d8a
commit
72cfd8191a
@ -13,6 +13,7 @@ function formatDate(iso: string): string {
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
year: 'numeric',
|
||||
timeZone: 'UTC',
|
||||
});
|
||||
} catch {
|
||||
return iso;
|
||||
|
||||
@ -51,6 +51,14 @@ const canonicalUrl = canonicalPath
|
||||
</head>
|
||||
<body class="bg-slate-950 text-slate-200 min-h-screen antialiased">
|
||||
<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>
|
||||
</html>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user