From e943876e704d3f3d6c23cf69e8da4bba14359d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= Date: Fri, 6 Mar 2026 16:52:48 +0100 Subject: [PATCH] fix: prevent age verification dialog flicker on page load Initialize isOpen as false and only open in onMount if not yet verified, instead of opening immediately and closing after localStorage check. Co-Authored-By: Claude Sonnet 4.6 --- .../age-verification-dialog/age-verification-dialog.svelte | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/frontend/src/lib/components/age-verification-dialog/age-verification-dialog.svelte b/packages/frontend/src/lib/components/age-verification-dialog/age-verification-dialog.svelte index 0f9344c..9bca3ca 100644 --- a/packages/frontend/src/lib/components/age-verification-dialog/age-verification-dialog.svelte +++ b/packages/frontend/src/lib/components/age-verification-dialog/age-verification-dialog.svelte @@ -13,7 +13,7 @@ const AGE_VERIFICATION_KEY = "age-verified"; - let isOpen = true; + let isOpen = $state(false); function handleAgeConfirmation() { localStorage.setItem(AGE_VERIFICATION_KEY, "true"); @@ -21,9 +21,8 @@ } onMount(() => { - const storedVerification = localStorage.getItem(AGE_VERIFICATION_KEY); - if (storedVerification === "true") { - isOpen = false; + if (localStorage.getItem(AGE_VERIFICATION_KEY) !== "true") { + isOpen = true; } });