-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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-knobs select should be able to have undefined options. #4487
Comments
Supporting In TypeScript it is common sense to use the question mark to declare optional parameters and properties. So an interface for a component's properties can look like this: interface Props {
environment?: 'linux' | 'mac' | 'win';
} Which is equivalent to: interface Props {
environment: 'linux' | 'mac' | 'win' | undefined;
} But different from: interface Props {
environment: 'linux' | 'mac' | 'win' | null;
} Unfortunately, it is not possible to use |
@igor-dv do you know who I could talk to about how knobs work so I could
implement this?
…On Wed, Nov 14, 2018 at 2:15 AM stale[bot] ***@***.***> wrote:
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!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#4487 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AALC40dIqnUb7u05ObKmKqxCdVS1rhC1ks5uu-0ngaJpZM4XvW0A>
.
|
@lifeiscontent , sorry for the delay =) you can chat with us on Discord: |
@lifeiscontent Are you still working on this? If not, I'll start looking into it 🙂 |
Looks like the root of the issue is that
@ndelangen you probably need to iterate on object fields manually instead of using reviver parameter of |
Hey, In TypeScript it would be something like this: interface Props {
environment?: 'linux' | 'mac' | 'win';
}
const myComponent = ({ environment = 'win' }: props ) => { (...) } but you can do the same in ES6 like this: const myComponent = ({ environment = 'win' }) => { (...) } if |
I can create an PR on friday if no one works on this yet ? |
Sure @christophehurpeau |
@christophehurpeau note that it's telejson library that needs a PR: |
I can't see how we could fix this in telejson, what about transorming undefined to 'undefined' before stringify ? |
honestly, I don't think telejson is the right starting point for this work, what about a reviver and replacer for the parse/stringify for the knobs? |
@lifeiscontent what makes you think so? |
Well, I guess it would depend on if telejson is only being used for knobs. Considering this is a requirement of just knobs currently it makes sense that it should live there, unless telejson is purposely built for knobs. If we later find we want the same functionality across another part of the platform it should then be revisited. Sent with GitHawk |
@lifeiscontent telejson states in the repo description that it supports
|
@Hypnosphi okay, then I guess it makes sense to do there. Are you working on this? Or should I open a PR? Sent with GitHawk |
No I'm not. Feel free to open a PR |
We probably need to upgrade telejson? |
Yeah I'll ship a new version soon. |
@ndelangen has a new version been shipped with this functionality yet? If not, is it possible to get a link somewhere this work is being tracked? |
Released in https://github.com/storybookjs/storybook/releases/tag/v5.3.0-beta.8 Closing this. Please holler if this didn't fix the problem |
@shilman still an issue with args. should have an option here to not have a value. |
If you are reporting a bug or requesting support, start here:
Bug or support request summary
I'd expect there to be a value called Undefined which is selectable, but it is removed when rendered in the knobs panel.
Please specify which version of Storybook and optionally any affected addons that you're running
Affected platforms
Screenshots / Screencast / Code Snippets (Optional)
The text was updated successfully, but these errors were encountered: