Replies: 1 comment 2 replies
-
There's a PR in draft for cookie issues #6648 |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
While working with the new cookies API, I realized some inconsistencies working with different browsers.
I've set
hooks.ts
Handle to do the following:cookies.get('valid_token')
isundefined
, set it to'true'
;cookies.get('valid_token')
is'true'
, set it to'false'
;cookies.get('valid_token')
is'false'
, delete cookie;The only browser that 'worked' as expected was Safari on the macOS [Version 15.6 (17613.3.9.1.5) – I haven't tested others]
With Google Chrome, you have to do a Hard Reload. Otherwise, the cookie is not going to get refreshed/applied.
With Firefox, it sets it to true, and that's it. Again, Hard Reload will force it to work.
Disabling cache in the Network tab will make it work on both Chrome and Firefox, but does that fix the problem in production with actual users? I cannot rely on -or ask- the users to do that)
hooks.ts
will print to the console the initial value of the cookie every time it runs, and it is apparent that the logic is running every time the page is refreshed. However, neither the value printed in the console nor the cookie stored in the browser is being updated with Chrome and Firefox. (unless a Hard Reload is made or Disable Cache is checked)I tried running the server both on dev and preview after build. Almost same results.
is it an issue with kit? Or is it a browser thing? Or am I doing something wrong?
Example Repository
Beta Was this translation helpful? Give feedback.
All reactions