Problem with reactivity and cookies.
I want to build a currency selector for my website, where I currently only display prices in USD.
I thought of making a currency selector that stores the selected currency as a cookie.
I made a composable called usePrice and a <Price/> component that gets a value and reactivly update the displayed price.
But the problem I have is, if I render the <Price/> component for example 10 times, only the last rendered component will reactivley change the displayed price when I change the currency.
The other ones will not. Only if I hard refresh the site they will show the updated price too.
I don't know where this problem comes from or if it has to do something with my logic.
Here is screenshots of my code:
1. Currency Selector Component
2. usePrice composable
3. <Price/> component
5 Replies
This is a known issue and currently the only solution is to downgrade to 3.11.3: https://github.com/nuxt/nuxt/issues/27660
GitHub
Use useCookie to modify the value in one component, but the value i...
Environment Operating System: Windows_NT Node Version: v20.9.0 Nuxt Version: 3.12.2 CLI Version: 3.12.0 Nitro Version: 2.9.6 Package Manager: [email protected] Builder: - Reproduction When running on my d...
Alright good to know, thanks!
in nuxt.config.ts
experimental: {
cookieStore: false,
},
helped to me
reactivity is working
I can confirm this works in the latest version of Nuxt 3 for us as well
Yes, works for me too 👍