Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/sharp-buckets-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@scaleway/cookie-consent": patch
---

Cookie consent provider now work on client and server side
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { useSegmentIntegrations } from './useSegmentIntegrations'

const COOKIE_PREFIX = '_scw_rgpd'
const HASH_COOKIE = `${COOKIE_PREFIX}_hash`
const IS_CLIENT = typeof document !== 'undefined'

// Appx 13 Months
const CONSENT_MAX_AGE = 13 * 30 * 24 * 60 * 60
Expand Down Expand Up @@ -72,7 +73,7 @@ export const CookieConsentProvider = ({
}>) => {
const [needConsent, setNeedsConsent] = useState(false)
const [cookies, setCookies] = useState<Record<string, string>>(
cookie.parse(document.cookie),
IS_CLIENT ? cookie.parse(document.cookie) : {},
)

const {
Expand Down