nuxt / nuxt

The Intuitive Vue Framework.

Home Page:https://nuxt.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

useCookie not updating value in browser

martinszeltins opened this issue · comments

Environment

Stackblitz

------------------------------
- Operating System: Linux
- Node Version:     v18.18.0
- Nuxt Version:     3.11.2
- CLI Version:      3.11.1
- Nitro Version:    2.9.6
- Package Manager:  npm@10.2.3
- Builder:          -
- User Config:      devtools
- Runtime Modules:  -
- Build Modules:    -
------------------------------

Reproduction

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

Describe the bug

When using useCookie it updates the cookie ref itself but the change is not reflected in browser devtools as can be seen in the screenshot below.

And when calling refreshCookie() it takes the value that is in the browser (old value) even when the ref value is newer.

Screenshot:
image

Additional context

No response

Logs

No response

@martinszeltins Try to click refresh button inside devtools after changing cookie value and it will show you updated value
image

@martinszeltins Try to click refresh button inside devtools after changing cookie value and it will show you updated value !

Nope, the value is not updating even when I refresh cookies.

@martinszeltins For me works on my laptop and Stackblitz too

I can assume that you confused urls in dev tools
Screenshot 2024-06-18 at 00 42 46

@hcz What is going on here? I tried it again, and the value is not updating. I am also looking at the .webcontainer.io url and it is not updating. Pressing "Refresh cookies" also does not update them.

image

EDIT
Looks like its my Chrome, because it updates on Firefox. Also noticed that locally it seems to work now on Chrome but still doesn't work on Chrome + Stackblitz. Tested on multiple computers. I have no idea what is going on.

image

@martinszeltins can you reproduce outside of Stackblitz?

@danielroe I am still able to reproduce it on Chrome Beta 127 (latest) - locally not on stackblitz. No such issue on Chrome stable. It's a clean browser without any extensions installed. I am pressing the cookies refresh button but it's not updating. Could it really be a Chrome bug?

On Chrome Stable: Cookie is not refreshing on Stackblitz
On Chrome Beta: Cookie is not refreshing on Stackblitz AND also locally.

I also noticed that setting the cookie using document.cookie = also does not work on Chrome Beta so looking like a Chrome issue.

I tested this on 3 computers 2 Linux 1 Windows - same issue

My system info:

------------------------------
- Operating System: Ubuntu 22.04.4 LTS
- Browser:          Google Chrome Version 127.0.6533.4 (Official Build) beta (64-bit)
- Node Version:     v18.14.2
- Nuxt Version:     3.11.2
- CLI Version:      3.12.0
- Package Manager:  npm@9.5.0
- User Config:      devtools
- Runtime Modules:  -
- Build Modules:    -
------------------------------

Screencat:
Peek 2024-06-19 09-07

Oh, and I just noticed this too:
Screenshot:
image

Thank you so much for your work on this.

Any chance you could raise an issue with Chrome in that case, and maybe investigate a bit further? 🙏

I have reported this issue to the Google Chrome team - https://issues.chromium.org/issues/348683488