-
Notifications
You must be signed in to change notification settings - Fork 94
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
useLocalStorageValue yields undefined on firstRender if initializeWithValue not set #1002
Comments
Thanks for the bug report! I managed to repeat this. Indeed, it seems that the default value of I'm looking into this. |
ArttuOll
added a commit
that referenced
this issue
Nov 4, 2022
…nstead of true The bug was caused by an accidental reference to a variable with the raw options provided by props instead of the variable with the props-provided options and default options merged. fix #1002
ArttuOll
added a commit
that referenced
this issue
Nov 4, 2022
The bug was caused by accidental references to a variable with the raw options provided by props instead of the variable with the props-provided options and default options merged. fix #1002
ArttuOll
added a commit
that referenced
this issue
Nov 4, 2022
The bug was caused by accidental references to a variable with the raw options provided by props instead of the variable with the props-provided options and default options merged. fix #1002
ArttuOll
added a commit
that referenced
this issue
Nov 4, 2022
This option was previously true by default, which is in conflict with this library's goal of supporting SSR out of the box. Also the documentation and the tests seem to presume that initializeWithValue is false by default. This is not a breaking change since due to a bug (#1002) initializeWithValue was effectively false by default already. re #1002
7 tasks
🎉 This issue has been resolved in version 17.0.1 🎉 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
What is the current behavior?
useLocalStorageValue
yields undefined on first render ifinitializeWithValue
not set to true and on second render yield actual value from localStorage.https://codesandbox.io/s/wispy-forest-qmrlzn?file=/src/App.tsx
What is the expected behavior?
initializeWithValue: true
should be default behavior based on documentation and previous behaviour.Environment Details
@react-hookz/web
version: 17.0react
version: 18.2react-dom
version: 18.2typescript
version: 4.8.4The text was updated successfully, but these errors were encountered: