Skip to content

Commit cb27649

Browse files
author
Tiago Dinis
committed
fix: deal with unpopulated state
1 parent a62d1c3 commit cb27649

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

www/app/cookie-banner/CookieBanner.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ const CookieBanner = ({ className, onConsents, ...rest }) => {
2020
});
2121

2222
const consents = useMemo(() => (
23-
state.consentedAt > Date.now() - (MAX_CONSENT_DAYS * 24 * 60 * 60 * 1000) ? state.consents : []
23+
state?.consentedAt > Date.now() - (MAX_CONSENT_DAYS * 24 * 60 * 60 * 1000) ? state?.consents : []
2424
), [state]);
25-
const rejected = !!(state.rejectedAt >= Date.now() - (MAX_REJECTED_DAYS * 24 * 60 * 60 * 1000));
25+
const rejected = !!(state?.rejectedAt >= Date.now() - (MAX_REJECTED_DAYS * 24 * 60 * 60 * 1000));
2626

2727
useEffect(() => setMounted(true), []);
2828

0 commit comments

Comments
 (0)