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

[Bug]: autodocs pages that only contain a single story show the same story twice #20969

Closed
yannbf opened this issue Feb 6, 2023 · 11 comments · Fixed by #21178
Closed

[Bug]: autodocs pages that only contain a single story show the same story twice #20969

yannbf opened this issue Feb 6, 2023 · 11 comments · Fixed by #21178
Assignees

Comments

@yannbf
Copy link
Member

yannbf commented Feb 6, 2023

Describe the bug

image

To Reproduce

Access a Storybook 7 project with autodocs, and create a single story for a component. Look at the docs entry and you will see two component, which seems redundant.

One would assume that there should be no need to display the same component twice, while others might argue the top one is a playground, and the bottom one is the fixed story (with original looks). Providing the story at the bottom when there are multiple stories does seem to make more sense, it just feels weird when there is a single story.

@chantastic
Copy link

chantastic commented Feb 6, 2023

leaving both seems like the "least magical" option to me. i know that i would be confused if i was navigating between docs for single and multiple story components and the default just wasn't there (in the case above)

i'd be inclined to leave it as is and see if it bothers anyone. it's a very logical default.
if other use-cases emerge, does the autodocs feature have the ability to accept user configuration?

@JReinhold
Copy link
Contributor

I tend to agree with @chantastic on this - keeping it is less magical than removing it, but I also get why you'd think that it's a bit weird to see.

if other use-cases emerge, does the autodocs feature have the ability to accept user configuration?

@chantastic yes we have plenty of configurations under parameters.docs.X, so we could add another one for this if we wanted.

Background info

This is caused by the recent decision to also show the primary story in the list below (before, the primary story was always omitted).

Which was caused by the question "where do we show the description for the primary story (which is NOT the same as the component description)?" to which the answer was "for consistency, we'll render the primary story in the list below, so it has a place for its description".

So if we wanted to get rid of the second story below in this one-story scenario, a question we'd need to answer is "where do we show the description for the story then, while also making it distinguishable from the component description?".

@JReinhold
Copy link
Contributor

@shilman
Copy link
Member

shilman commented Feb 8, 2023

I vote hiding the stories section when there's just a single story. It doesn't make sense and looks like a bug, and we're already hearing that from users.

@shilman shilman moved this to Required for RC in Core Team Projects Feb 8, 2023
@JReinhold
Copy link
Contributor

I vote hiding the stories section when there's just a single story. It doesn't make sense and looks like a bug, and we're already hearing that from users.

Alright, and what do you suggest we do with the primary story's description then? Move it up below the component description, or omit it altogether?

@JReinhold JReinhold self-assigned this Feb 8, 2023
@JReinhold JReinhold moved this from Required for RC to In Progress in Core Team Projects Feb 18, 2023
@JReinhold JReinhold linked a pull request Feb 21, 2023 that will close this issue
5 tasks
@github-project-automation github-project-automation bot moved this from In Progress to Done in Core Team Projects Feb 23, 2023
@shilman
Copy link
Member

shilman commented Feb 24, 2023

Ermahgerd!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-beta.54 containing PR #21178 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb@next upgrade --prerelease

@adirzoari
Copy link

adirzoari commented Mar 12, 2024

@yannbf @JReinhold @shilman Hi, what configuration I need to add to show only docs and not stories?

@yannbf
Copy link
Member Author

yannbf commented Mar 26, 2024

@yannbf @JReinhold @shilman Hi, what configuration I need to add to show only docs and not stories?

Do you mean --docs?

@adirzoari
Copy link

@yannbf exactly!!! can I build a storybook with only docs and deploy it?

@yannbf
Copy link
Member Author

yannbf commented Mar 26, 2024

@yannbf exactly!!! can I build a storybook with only docs and deploy it?

Yes, please read the docs that I shared, it covers that. Also, you please use the https://discord.gg/storybook discord community for more questions, you will probably get better help there!

@adirzoari
Copy link

@yannbf great, that's what I'm looking for

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

Successfully merging a pull request may close this issue.

6 participants