Skip to content

[Bug]: !autodocs does not hide the preview of the story in the documentation if it is the first story #32683

@Evi-2003

Description

@Evi-2003

Describe the bug

The !autodocs tag still displays the story as a preview of the component if it is the first story in the file. If the story is moved after the first one, it is completely hidden as expected.

Expected behavior: The !autodocs tag should hide the story completely from the documentation, regardless of its location within the file.

Image

Reproduction Repo

Reproduction link

https://68e7c3607e6dc5d3051d143e-zfywlhkgqk.chromatic.com/?path=/docs/example-button--docs

Reproduction steps

  1. Add tag: [!autodocs] to the first story in the code.
  2. In the component documentation, the preview of the component is the story to which we just added !autodocs.

System

➜  storybook-docs-issue git:(main) ✗ npx storybook@latest info

Storybook Environment Info:

  System:
    OS: macOS 26.0
    CPU: (8) arm64 Apple M1 Pro
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.20.0 - ~/.nvm/versions/node/v22.20.0/bin/node
    npm: 10.9.3 - ~/.nvm/versions/node/v22.20.0/bin/npm <----- active
    pnpm: 10.17.1 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 141.0.7390.56
    Safari: 26.0
  npmPackages:
    @storybook/addon-docs: ^9.1.10 => 9.1.10
    @storybook/preset-create-react-app: ^9.1.10 => 9.1.10
    @storybook/react-webpack5: ^9.1.10 => 9.1.10
    eslint-plugin-storybook: ^9.1.10 => 9.1.10
    storybook: ^9.1.10 => 9.1.10

Additional context

The story will be hidden under "STORIES" in the docs, but it is still shown as a preview if it's the first story in the file.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions