Skip to content

Commit

Permalink
fix: deal with unpopulated state
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiago Dinis committed Mar 10, 2022
1 parent a62d1c3 commit cb27649
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions www/app/cookie-banner/CookieBanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ const CookieBanner = ({ className, onConsents, ...rest }) => {
});

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

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

Expand Down

0 comments on commit cb27649

Please sign in to comment.