-
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
Fix initializeWithValue
default not respected, fix docs and tests
#1003
Conversation
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
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
initializeWithValue
default not respected and set it to false
by default`initializeWithValue
default not respected and set it to false
by default
Codecov Report
@@ Coverage Diff @@
## master #1003 +/- ##
=======================================
Coverage 99.61% 99.61%
=======================================
Files 61 61
Lines 1039 1039
Branches 165 165
=======================================
Hits 1035 1035
Misses 2 2
Partials 2 2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Hi! |
I understand your concern. However, supporting SSR is one of the key goals of this library. Settings |
That is the change from previous implementation, previously SSR users had to set this option to false, wheras this time it is set to |
So basically #1003 is about changed default value and docs not being fully actualized. |
@ArttuOll I'd like you to make default value to be |
I see. I'll edit this that way then. That'll require some larger changes to the tests. |
yeah, sorry🙏 been distracted during design of reworked hook 🙈 |
Yeah, reflecting on it a little bit more. |
or you can just |
…ault" This reverts commit 3207d0d.
Btw, this becomes a breaking change now since we are setting |
…n initializeWithValue Previously the docs would imply in the top part that initializeWithValue was false by default, which is not the case.
That was a 'bug' 🙃 |
initializeWithValue
default not respected and set it to false
by defaultinitializeWithValue
default not respected, fix docs and tests
🎉 This PR is included in version 17.0.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What is the current behavior, and the steps to reproduce the issue?
initializeWithValue
default value is not respected. It is always read from user-givenoptions
, meaning that it isundefined
(effectivelyfalse
), if the user did not explicitly set it.Reproduction steps are given in #1002 . It looks like
initializeWithValue
isfalse
by default (which is what the bug report is about), but actually it's just that the default value oftrue
is not respected.Additionally, I noticed that the default value for
initializeWithValue
is set totrue
, which partly contradicts the documentation (in the top part of the docs ofuseSessionStorageValue
anduseLocalStorageValue
initializeWithValue
is said to befalse
by default, but in the description of theoptions
argument it is said to betrue
) and the tests. After fixinguseStorageValue
to respect the default value ofinitializeWithValue
it became necessary to set it tofalse
, otherwise SSR tests would fail, as they should.What is the expected behavior?
The
initializeWithValue
default should be respected and it should befalse
by default.How does this PR fix the problem?
initializeWithValue
is used if it is not provided by the user.initializeWithValue
tofalse
by default.false
.Checklist