Skip to content
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

Addon-controls: Support undefined option for optional values #13259

Closed
lifeiscontent opened this issue Nov 25, 2020 · 2 comments
Closed

Addon-controls: Support undefined option for optional values #13259

lifeiscontent opened this issue Nov 25, 2020 · 2 comments

Comments

@lifeiscontent
Copy link
Member

Describe the bug

should have an option to set an arg to undefined if its optional

To Reproduce
Steps to reproduce the behavior:

  1. Create a UI Component + Story
    2.Add an optional prop
  2. See that there is no option to set the arg to undefined in storybook controls / docs

Expected behavior
I'd expect that if an arg is optional, it should have undefined as a value in args.

Screenshots
Screen Shot 2020-11-24 at 4 41 54 PM

Screen Shot 2020-11-24 at 4 43 19 PM

Code snippets
If applicable, add code samples to help explain your problem.

System
Please paste the results of npx sb@next info here.

Additional context
Related bug that was fixed previously: #4487

@shilman shilman added this to the 6.2 args milestone Nov 25, 2020
@shilman shilman changed the title Addon Controls has old bug of Knobs Addon-controls: Support undefined option for optional values Nov 25, 2020
@stale
Copy link

stale bot commented Dec 25, 2020

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Dec 25, 2020
@stale stale bot removed the inactive label Feb 8, 2021
@shilman shilman removed their assignment Feb 8, 2021
@shilman shilman added the todo label Mar 2, 2021
@shilman shilman modified the milestones: 6.2 args, 6.2 candidates Mar 4, 2021
@shilman shilman removed this from the 6.2 candidates milestone Mar 11, 2021
@tmeasday
Copy link
Member

tmeasday commented May 14, 2021

@lifeiscontent see #14579.

The TLDR is:

  1. In code: You can set an arg to undefined, purely by not setting the arg in the story (we no longer set the arg to its default value).
  2. In controls: You can reset all arg values to the story's initial values (so undefined if the story didn't set it) with the reset button
  3. You cannot set a control to undefined if the story set a value.

This was a decision discussed at length with @shilman and @domyen, it seemed a good compromise between over-complicating things and letting a user do what they want to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants