You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// install dependencies
npm i
// run dev server
npm run dev
Describe the bug
We have page with one component that uses multiple times.
Each component uses useCookies composable to read and write values to cookie storage with the same cookie's name.
useCookie doesn't write new value in cookies storage if composable used in multiple components.
I have figured that when I use useCookie multiple times it creates local reactive state every time.
And when I click setCookie1 after setCookie2 then basically watch inside useCookie doesn't trigger, because the value of foo remains the same in that local reactive state.
This behavior was not clear from the docs. Perhaps we should add this info.
Another idea is to add listeners for browser's cookies events that will trigger reactive updates of the useCookie. That would be a nice feature.
Environment
Reproduction
https://github.com/evgenii-code/nuxt-bridge-use-cookies
Describe the bug
We have page with one component that uses multiple times.
Each component uses
useCookies
composable to read and write values to cookie storage with the same cookie's name.useCookie
doesn't write new value in cookies storage if composable used in multiple components.First usage of component:
Second usage of component
If we run methods in that order:
setCookie1
,setCookie2
andsetCookie1
again, then cookie value in browser's storage stays'2'
, but should be'1'
.Here is a little video to show of this behaviour
https://imgur.com/gUjDhcc
Code of the component
Code of the page
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: