fix(lint): fix react-hooks/immutability error in InitialLoader

This commit is contained in:
2026-06-21 11:04:54 +02:00
parent 272b7a397b
commit 908f2b0b69

View File

@@ -8,6 +8,12 @@ import Image from 'next/image';
export function InitialLoader({ shouldShowLoader = true }: { shouldShowLoader?: boolean }) {
const [isLoading, setIsLoading] = useState(shouldShowLoader);
const finishLoading = () => {
// Set a session cookie so the server knows not to render the loader again
document.cookie = "etib_initial_loader_v5=true; path=/; samesite=lax";
setIsLoading(false);
};
useEffect(() => {
if (!shouldShowLoader) return;
@@ -21,12 +27,6 @@ export function InitialLoader({ shouldShowLoader = true }: { shouldShowLoader?:
return () => clearTimeout(timeout);
}, [shouldShowLoader]);
const finishLoading = () => {
// Set a session cookie so the server knows not to render the loader again
document.cookie = "etib_initial_loader_v5=true; path=/; samesite=lax";
setIsLoading(false);
};
// Wenn wir serverseitig rendern und es nicht zeigen sollen, return null
if (!shouldShowLoader) return null;