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

Handling of undefined parameters in Stories #605

Open
pReya opened this issue Mar 4, 2025 · 0 comments
Open

Handling of undefined parameters in Stories #605

pReya opened this issue Mar 4, 2025 · 0 comments

Comments

@pReya
Copy link

pReya commented Mar 4, 2025

This is a question regarding the behavior of undefined story parameters and how they're supposed to work, because I only found this out from looking at old PRs. Seems this is not in the docs (or I was too blind to see it?).

Whenever you have undefined as a possible value for a parameter, it will always be cast into a string. So if you want to do any conditional rendering, you can't check for truth/boolean value, but you need to explicitly compare it as a string.

From what I understand, this is expected/wanted functionality, right?

I've created an example here: https://stackblitz.com/edit/ladle-m2rhbuxm?file=src%2Fcontrols.stories.tsx
Please look at the controls.stories.tsx file.

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

No branches or pull requests

1 participant