diff --git a/components/providers/InitialLoader.tsx b/components/providers/InitialLoader.tsx index 4c7207061..70f0c1ff6 100644 --- a/components/providers/InitialLoader.tsx +++ b/components/providers/InitialLoader.tsx @@ -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;