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

Sidebar subheadings unexpectedly appearing #11692

Closed
astrotim opened this issue Jul 26, 2020 · 10 comments
Closed

Sidebar subheadings unexpectedly appearing #11692

astrotim opened this issue Jul 26, 2020 · 10 comments

Comments

@astrotim
Copy link

Since upgrading from v6-beta to v6-rc, we've noticed that some stories are getting the non-expandable groupings in the sidebar while others aren’t, and I can’t see any difference in how they are implemented.

For example our MDX page for Button appears in a folder in alphabetical order.

docs-button

It is marked up with the Meta component

// Button.stories.mdx
<Meta title="Button/Docs" />

while our MDX page for List appears with a subheading, at the end of the alphabetical list. It is marked up the same

docs-list

// List.stories.mdx
<Meta title="List/Docs" />

The configuration of these two components is very similar.

// Button.js
export default Button
// Button.story.js
export default {
  title: 'Button',
}
// List.js
export default List
// List.story.js
export default {
  title: 'List',
}

Note: we use ComponentName.stories.mdx and ComponentName.story.js simply to make the MDX appear before the CSF in the navigation order.

To Reproduce
We don't have any public-facing URLs to share unfortunately, but the Storybook admins may have access to view our Chromatic builds. There are also some illustrative screenshots below.

Chromatic build using v6-rc which demonstrates the appearance of 6 subheadings below the main alphabetically ordered story list.

Expected behavior
I expected not to see subheadings since there were no code changes related to opting in to this appearance.

Chromatic build using v6-beta which shows the same 6 components folders in alphabetical order without any sub headings.

Screenshots

After: v6-rc.3 (sub headings appearing - screenshot simplifed for brevity)
stories-order

Before: v6-beta (no subheadings - screenshot simplifed for brevity)
story-order-v6-beta

Code snippets
If applicable, add code samples to help explain your problem.

System:
Results of npx -p @storybook/cli@next sb info - TBD

Packages installed:

"@storybook/addon-actions": "6.0.0-rc.3",
"@storybook/addon-backgrounds": "6.0.0-rc.3",
"@storybook/addon-controls": "6.0.0-rc.3",
"@storybook/addon-docs": "6.0.0-rc.3",
"@storybook/addon-knobs": "6.0.0-rc.3",
"@storybook/addon-viewport": "6.0.0-rc.3",
"@storybook/addons": "6.0.0-rc.3",
"@storybook/react": "6.0.0-rc.3",

Additional context
We have worked around this for now by disabling the subheadings via:

addons.setConfig({
  showRoots: false
});

But we would like to evolve towards using the subheadings, so it would be great to understand why and how to use them properly.

@shilman shilman added this to the 6.0 milestone Jul 26, 2020
@ndelangen ndelangen self-assigned this Jul 28, 2020
@ndelangen
Copy link
Member

@astrotim Do you think you could help me reproduce this?

I'm sure there's a bug / unwanted feature in there, but in our official storybook example (which does use a combination of storieOf, MDX, CSF)

Do you have any pointers to what you think might be the cause of this?

@ndelangen ndelangen modified the milestones: 6.0, 6.0.x Aug 4, 2020
@astrotim
Copy link
Author

astrotim commented Aug 5, 2020

@ndelangen I haven't been able to spot any clues on this one, but I'll try reproducing it on a branch in the Storybook example and see how that goes.

@ndelangen
Copy link
Member

Thanks @astrotim 👍

@stale
Copy link

stale bot commented Sep 7, 2020

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!

@stale stale bot added the inactive label Sep 7, 2020
@shilman shilman added the PN label Sep 25, 2020
@stale stale bot removed the inactive label Sep 25, 2020
@shilman shilman removed the tracked label Sep 25, 2020
@doublejosh
Copy link
Contributor

doublejosh commented Oct 15, 2020

I was also stumped by the subheading logic. Seems to only appear when components are put into a folder with no root component/story.

However, on auto-reload it sometimes appears *once if the path root string doesn't match the folder name it's in. But it goes away on reload :)

@shilman shilman modified the milestones: 6.0.x, 6.1 core Nov 2, 2020
@shilman
Copy link
Member

shilman commented Nov 4, 2020

Can you try upgrading to 6.1 and see if it's fixed with the new sidebar?

npx sb upgrade --prerelease

@astrotim
Copy link
Author

astrotim commented Nov 4, 2020

OK, will do!

@stale
Copy link

stale bot commented Dec 25, 2020

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!

@stale stale bot added the inactive label Dec 25, 2020
@doublejosh
Copy link
Contributor

Here's the docs on "roots"...
https://storybook.js.org/docs/react/configure/sidebar-and-urls#roots

@stale stale bot removed the inactive label Jan 5, 2021
@shilman
Copy link
Member

shilman commented Feb 26, 2021

Closing this for now. Please let me know if there's more to be done here!

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

No branches or pull requests

5 participants