-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
useSessionStorageValue same key, different value #451
Labels
Comments
xobotyi
added a commit
that referenced
this issue
Dec 23, 2021
🎉 This issue has been resolved in version 12.0.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Well, nope, didnt worked out. Ill dig more later. |
I'm investigating this also. Will report here if I find anything out. |
I can confirm that:
|
7 tasks
🎉 This issue has been resolved in version 17.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prior Issues
I cannot see any related issues.
What is the current behavior?
Different instances of
useSessionStorageValue
with the same key that are mounted at the same can get out of sync when setValue is use on first mount within a useEffect. Only the component making the setValue call, and components before it, get the updated value. Components after do not update and have a stale value.Steps to Reproduce
Using
setValue
in auseEffect(..., [])
.codesandbox: https://codesandbox.io/s/eager-gould-ter7m?file=/src/App.js
The code above on first load displays:
Another codesandbox with random values and reset buttons: https://codesandbox.io/s/fervent-stitch-zqekk
There's a few work arounds:
initializeWithStorageValue: false
What is the expected behavior?
All instances of
useSessionStorageValue
with the same key should return the same value.Environment Details
@react-hookz/web
version: 12.0.0react
version: 17.0.2react-dom
version: 17.0.2typescript
version: N/AThe text was updated successfully, but these errors were encountered: