Skip to content

Commit

Permalink
fix cookie path in cookieStorage (#3970)
Browse files Browse the repository at this point in the history
* fix cookie path in cookieStorage

If the path of cookie is not set, there will be multiple `wagmi.store` in the cookie (under different paths), and the values are inconsistent. At this point, obtaining the value of the cookie will be uncontrollable.

* fix path=/

* chore: changeset

---------

Co-authored-by: Tom Meagher <tom@meagher.co>
  • Loading branch information
nanxiaobei and tmm committed May 28, 2024
1 parent ee9d90d commit 030c7c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/stupid-dancers-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wagmi/core": patch
---

Fixed `cookieStorage` not working across paths.
2 changes: 1 addition & 1 deletion packages/core/src/utils/cookie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const cookieStorage = {
},
setItem(key, value) {
if (typeof window === 'undefined') return
document.cookie = `${key}=${value}`
document.cookie = `${key}=${value};path=/`
},
removeItem(key) {
if (typeof window === 'undefined') return
Expand Down

0 comments on commit 030c7c2

Please sign in to comment.