You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the latest version of Storybook (6.2), props with an enum/string literal typing are incorrectly displaying undefined on the Controls panel (what used to be the Knobs addon).
It looks like the culprit is a conflict between the shouldExtractLiteralValuesFromEnum and shouldRemoveUndefinedFromOptional option flags. Storybook currently has both set to true, but the conversion to enum is outputting a value that takes priority over the string with undefined removed.
Honestly, I'm over my head debugging this (😅) but it seems to me that this part of parser.ts:
Soooo ... I had a look and the problem is, that I could not find a single case where "undefined" gets added to the propTypeString in the tests. So I created a new component and tested some things out ... turns out that the package itself does not add the | undefined by default.
You were right with the code block you mentioned. I can only suspect, that there is some kind of edge-case in the storybook implementation.
In the latest version of Storybook (6.2), props with an enum/string literal typing are incorrectly displaying
undefined
on the Controls panel (what used to be the Knobs addon).It looks like the culprit is a conflict between the
shouldExtractLiteralValuesFromEnum
andshouldRemoveUndefinedFromOptional
option flags. Storybook currently has both set totrue
, but the conversion to enum is outputting a value that takes priority over the string withundefined
removed.Honestly, I'm over my head debugging this (😅) but it seems to me that this part of
parser.ts
:Could have a conditional that checks whether
shouldRemovedUndefinedFromOptional
istrue
and then filters outundefined
values from the enum.Related issue on Storybook for full context: storybookjs/storybook#14523
The text was updated successfully, but these errors were encountered: