Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: The setCookieData() method can accidentally delete the lastConsentTimestamp field from the cc-cookie #702

Closed
peaemaye opened this issue Jun 27, 2024 · 0 comments · Fixed by #701
Labels
bug Something isn't working
Milestone

Comments

@peaemaye
Copy link
Contributor

peaemaye commented Jun 27, 2024

Expected Behavior

Calling setCookieData() should update the cookie data field without removing the lastConsentTimestamp from the cookie.

Current Behavior

There are some rare circumstances where calling the setCookieData() method causes the lastConsentTimestamp field on the cookie to be lost. Only happens if it's called when the state is otherwise unchanged as state._savedCookieContent.lastConsentTimestamp is only set in the saveCookiePreferences() method if the state has changes or the current consent is invalid.

Steps to reproduce

See this codesandbox for a minimal repro https://codesandbox.io/p/sandbox/cookieconsent1-8jyvgt?file=%2Findex.js (seems to work better with cookies than StackBlitz)

It's a bit a of a contrived example but I think demonstrates the issue without having to involve iframemanager like my real world use case.

Proposed fix or additional info.

See PR: #701

Version

3.0.1

On which browser do you see the issue?

Chrome

@peaemaye peaemaye added the bug Something isn't working label Jun 27, 2024
@github-actions github-actions bot added the triage yet to be reviewed label Jun 27, 2024
@orestbida orestbida removed the triage yet to be reviewed label Jul 2, 2024
@orestbida orestbida added this to the v3.1.0 milestone Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants