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
Vue Component's Boolean Prop default is false
, not undefined
.
#11839
Comments
It's just not vue, the default for StacktraceWarning: A component is changing an uncontrolled input of type checkbox to be controlled. Input elements should
not switch from uncontrolled to controlled (or vice versa). Decide between using a controlled or uncontrolled input
element for the lifetime of the component. More info: https://fb.me/react-controlled-components
in input (created by BooleanControl)
in label (created by Context.Consumer)
in Styled(label) (created by BooleanControl)
in BooleanControl (created by ArgControl)
in ArgControl (created by ArgRow)
in td (created by ArgRow)
in tr (created by ArgRow)
in ArgRow (created by ArgsTable)
in tbody (created by ArgsTable)
in table (created by Context.Consumer)
in Styled(table) (created by ArgsTable)
in div (created by Context.Consumer)
in Styled(div) (created by ArgsTable)
in ArgsTable (created by ControlsPanel)
in ControlsPanel
in div (created by AddonPanel)
in AddonPanel
in div (created by Context.Consumer)
in Styled(div)
in div (created by Context.Consumer)
in Styled(div)
in Unknown
in Unknown
in Unknown
in Unknown (created by ManagerConsumer)
in ManagerConsumer (created by Panel)
in Panel (created by Layout)
in div (created by Context.Consumer)
in Styled(div) (created by Panel)
in Panel (created by Layout)
in div (created by Context.Consumer)
in Styled(div) (created by Main)
in div (created by Context.Consumer)
in Styled(div) (created by Main)
in Main (created by Layout)
in Layout (created by Context.Consumer)
in WithTheme(Layout)
in Unknown
in div (created by Context.Consumer)
in Styled(div)
in Unknown (created by SizeMeRenderer(Component))
in SizeMeReferenceWrapper (created by SizeMeRenderer(Component))
in SizeMeRenderer(Component) (created by SizeMe(Component))
in SizeMe(Component)
in ThemeProvider
in Unknown (created by ManagerConsumer)
in ManagerConsumer (created by Manager)
in EffectOnMount (created by Manager)
in Manager (created by Context.Consumer)
in Location (created by QueryLocation)
in QueryLocation (created by Root)
in LocationProvider (created by Root)
in HelmetProvider (created by Root)
in Root |
Just some thoughts after talking to @shilman about this: Regarding your Vue example:
Everything else is left untouched, including when |
Whoopee!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.0.21 containing PR #12322 that references this issue. Upgrade today to try it out! Closing this issue. Please re-open if you think there's still more to do. |
Unfortunately this issue also exists as of today, version 6.1.18, for numbers specifically. Given this React component prop types for example:
The controls add-ons will display: and you will get the exact same warning as soon as you enter a value in the input field that says "Adjust number dynamically", for the same reason I assume (it was undefined in Storybook's React component, now defined):
Should we re-open? |
@sebastienbarre Might be fixed in an open PR by @tmeasday |
Here's the PR: #13911 |
Thanks @tmeasday, looking forward the next release. I tried the pre-release, it broke my Storybook pretty badly. I'm sure it will be all good in the official release. |
Vue Component has a special boolean prop use case, when not giving boolean prop default value, the boolean prop's default value is
false
, notundefined
Please see this minimum v6 example
TestProp.vue
TestProp.stories.js
If Storybook not changing default boolean prop to
false
, people will often trigger this warning when tweaking knobs.Then people will have to write
Primary.args = { disabled: false }
manually to suppress this warning.The text was updated successfully, but these errors were encountered: