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:
@@ -3,9 +3,11 @@
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
export default function NotificationDebug() {
|
export default function NotificationDebug() {
|
||||||
|
const [mounted, setMounted] = useState(false);
|
||||||
const [debug, setDebug] = useState<any>({});
|
const [debug, setDebug] = useState<any>({});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
setMounted(true);
|
||||||
const info = {
|
const info = {
|
||||||
notificationSupported: 'Notification' in window,
|
notificationSupported: 'Notification' in window,
|
||||||
serviceWorkerSupported: 'serviceWorker' in navigator,
|
serviceWorkerSupported: 'serviceWorker' in navigator,
|
||||||
@@ -16,6 +18,10 @@ export default function NotificationDebug() {
|
|||||||
setDebug(info);
|
setDebug(info);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
if (!mounted) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
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="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>
|
<div className="font-bold mb-2">Push Debug:</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user