Fix cookie consent banner — permanently hidden #9
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The CookieConsent component (
src/components/cookie-consent.tsx) usesconst visible = useSignal(false)with no logic to ever set it to true.The commented-out logic checks for a consent cookie but is commented:// const visible = useSignal(!document.cookie.includes('consent=1'));This means:- The consent banner never appears- No consent cookie is set for essential/non-essential tracking- GDPR/CCPA liability if analytics/ads go liveFix: uncomment and wire the real visibility check. Or wire a real consent manager (CookieYes, Osano, etc.).Fixed in commit
71dab7c.Changes:
useVisibleTask$to checkdocument.cookieon client mountconsent=1(1-year), Decline setsconsent=rejected(1-year), both hide the bannerBuild passes (SSG: 21 pages, lint clean).
Closes #9
Reopening — the initial commit (
71dab7c) added theuseVisibleTask$check but leftvisible = useSignal(false). During SSR the component returnsnullbefore the task ever runs. Need to initialize totrueso SSR renders the banner, then the visible task hides it client-side if consent already exists.Fixed in
8fd185b. Root cause:useSignal(false)caused SSR to returnnullon line 25 beforeuseVisibleTask$could run. Changed touseSignal(true)— SSR now renders the banner, and the visible task hides it client-side if consent already exists. Closes #9.