-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: Add final
parameter to onConsentChange
#664
Conversation
According to @sookburt , @theemilyturner asked Susan Bingham about whether we should reload the page for a consent change, and the answer was no, so this is no longer relevant. |
as evidenced here: https://trello.com/c/sqmNkN20 |
This might need to be resurrected as part of the cookie deny list changes. |
ad339e6
to
83a9e38
Compare
🦋 Changeset detectedLatest commit: ad2e8ad The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Coverage report
Test suite run success331 tests passing in 16 suites. Report generated by 🧪jest coverage report action from ad2e8ad |
🚀 0.0.0-beta-20240124124059 published to npm as a beta release |
🚀 0.0.0-beta-20240206103322 published to npm as a beta release |
🚀 0.0.0-beta-20240207101556 published to npm as a beta release |
🚀 0.0.0-beta-20240213105136 published to npm as a beta release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this. This was tested in CODE and worked as expected.
What does this change?
final
parameter toonConsentChange
which defaults tofalse
. When a true value is passed, the callback is pushed onto a newfinalCallbackQueue
. ThefinalCallbackQueue
's callbacks are guaranteed to execute after the defaultcallBackQueue
's when consent state changes.Why?
onConsentChange
to register a callback that reloads the page when consent state changes from a state where the user has accepted targeted advertising to one which rejects it or vice versa.onConsentChange
callback opens up the possibility of overriding other uses ofonConsentChange
whose callbacks won't have time to execute before the page is reloaded. This could cause bugs that are very difficult to track down.Promise.resolve().then
and / orsetTimeout
so that the callback that reloads the page is put on the microtask queue or task queue respectively. This would increase the probability but not guarantee that other callbacks registered withonConsentChange
could execute before the page is reloaded.