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
Describe the bug
The new single story hoisting feature in Storybook v6.1 will only hoist a story if the default export's title does not contain leading or trailing whitespace around the story name.
To Reproduce
Create a (CSF/MDX) story with:
A title of the form Group / Component (note the spaces around /)
A story function named Component
npm run storybook
See error
Expected behavior
Single stories should be hoisted correctly, regardless of whether the story name has leading or trailing whitespace.
Screenshots / Code snippets
The following code correctly hoists the story name:
Additional context
The documentation for single story hoisting does mention that the component and story names must match exactly, but it does not make clear that this includes whitespace before or after the component name. This is likely to be broadly confusing for developers, especially since adding spaces around the title delimiter doesn't break the sidebar tree generation generally.
The text was updated successfully, but these errors were encountered:
This is a bug in extracting the component name from the title string. It shouldn't contain leading or trailing whitespace. Interestingly, the root/folder names work fine. Take for example:
Describe the bug
The new single story hoisting feature in Storybook v6.1 will only hoist a story if the default export's
title
does not contain leading or trailing whitespace around the story name.To Reproduce
Group / Component
(note the spaces around/
)Component
npm run storybook
Expected behavior
Single stories should be hoisted correctly, regardless of whether the story name has leading or trailing whitespace.
Screenshots / Code snippets
The following code correctly hoists the story name:
But adding spaces around the
title
delimiter does not:Manually setting
Focus.storyName = ' Focus'
(with the leading space) does correctly hoist the story.System
Additional context
The documentation for single story hoisting does mention that the component and story names must match exactly, but it does not make clear that this includes whitespace before or after the component name. This is likely to be broadly confusing for developers, especially since adding spaces around the title delimiter doesn't break the sidebar tree generation generally.
The text was updated successfully, but these errors were encountered: