nuxt / nuxt

The Intuitive Vue Framework.
https://nuxt.com
MIT License
54.95k stars 5.03k forks source link

useCookie doesn't change value of an object stored in cookie #24969

Closed GhostvOne closed 10 months ago

GhostvOne commented 10 months ago

Environment


Reproduction

https://stackblitz.com/edit/nuxt-starter-4fsr9x?file=app.vue

Describe the bug

Same as https://github.com/nuxt/nuxt/issues/22001 When I store an object in a cookie using useCookie composable and then want to change the value of a key of that object it doesn't effect the cookie in the web browser. The value in the ref is good but value registered in the cookie browser it not updated.

Additional context

No response

Logs

No response

stackblitz[bot] commented 10 months ago

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

Ganthology commented 10 months ago

Hi, I tested the repro locally on my mac machine and it seems to be working fine.

Not sure if it's stackblitz behaviour that did not update the cookies correctly in browser, here's a stackblitz repro from another issue related to cookie that I tested.

Attached is a demo of me running the repro locally, can notice that the cookie did update when I click refresh after hitting the button. Hope it helps!

https://github.com/nuxt/nuxt/assets/18641991/df40d72c-5117-4506-aaa7-120ad8340fa6