Skip to content

Handling of undefined parameters in Stories #605

Description

@pReya

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.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions