fix: prevent hydration error in NotificationDebug component

Add mounted state to prevent rendering during SSR.
Component now only renders after client-side mount.
This commit is contained in:
2025-12-07 01:53:52 +00:00
parent 298ebc5fb9
commit 1c5e623c7b

View File

@@ -3,9 +3,11 @@
import { useEffect, useState } from 'react';
export default function NotificationDebug() {
const [mounted, setMounted] = useState(false);
const [debug, setDebug] = useState<any>({});
useEffect(() => {
setMounted(true);
const info = {
notificationSupported: 'Notification' in window,
serviceWorkerSupported: 'serviceWorker' in navigator,
@@ -16,6 +18,10 @@ export default function NotificationDebug() {
setDebug(info);
}, []);
if (!mounted) {
return null;
}
return (
<div className="fixed bottom-4 left-4 bg-black text-white text-xs p-3 rounded-lg max-w-xs z-50 font-mono">
<div className="font-bold mb-2">Push Debug:</div>