You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When setting a boolean default prop value, for example, const shouldBeNullByDefault = boolean('Should Be Null By Default', null);, the value is null but changes to false if page is reloaded.
You will see a <h3> that was added at the top of the story. "Should be `null` by default: null".
Reload the page, and null will now be false. This is important because when it is false, the prop will be passed to the component, but if it was null, it would not.
Please specify which version of Storybook and optionally any affected addons that you're running
Just some insights about this issue, this is happening because:
First time the value is null, serialized as 'null' (String), and stored in query-params
When you reload the page, the value is loaded
First from stories (value is still null)
Second from the query params, which has the serialized version of type String, and when the deserialization happens (value === 'true') it ends having value equals to false
When setting a boolean default prop value, for example,
const shouldBeNullByDefault = boolean('Should Be Null By Default', null);
, the value isnull
but changes tofalse
if page is reloaded.Steps to reproduce
Clone repo:
git@github.com:CLL80/storybook.git
Checkout branch:
knob-test
Run storybook
Go to the
withKnobs
story:http://localhost:9011/?selectedKind=Addons%7CKnobs.withKnobs&selectedStory=tweaks%20static%20values
You will see a
<h3>
that was added at the top of the story. "Should be `null` by default: null".Reload the page, and
null
will now befalse
. This is important because when it isfalse
, the prop will be passed to the component, but if it wasnull
, it would not.Please specify which version of Storybook and optionally any affected addons that you're running
@storybook/react 4.0.0-alpha.2
@storybook/addon-knobs 4.0.0-alpha.2
I first noticed this issue using v3.3.10.
The text was updated successfully, but these errors were encountered: