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

Updating the cookie in hook instance A doesnt rerender hook instance B #2

Open
breytex opened this issue Dec 11, 2019 · 1 comment
Open

Comments

@breytex
Copy link

breytex commented Dec 11, 2019

When I useCookie multiple times with the same key in my project and call setCookie on one instance, the other instance doesn't re-render which is an unexpected behaviour.

You could implement a observer-pattern between all cookie instances to sync state with the same key.

@firatoezcan
Copy link
Owner

firatoezcan commented Dec 11, 2019

Good idea, but instead of an observer I'd rather switch to using the onChanged event for cookies as documented here: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/cookies/onChanged

Feel free to make a PR to add that functionality. This is not supported for Edge versions that are not Chromium though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants