Skip to content

Comments

React: Fix manifest stories empty when meta has no explicit title#33878

Merged
kasperpeulen merged 1 commit intonextfrom
kasper/fix-manifest-stories-no-title
Feb 20, 2026
Merged

React: Fix manifest stories empty when meta has no explicit title#33878
kasperpeulen merged 1 commit intonextfrom
kasper/fix-manifest-stories-no-title

Conversation

@kasperpeulen
Copy link
Contributor

@kasperpeulen kasperpeulen commented Feb 20, 2026

Closes #

What I did

Fixed component manifest generating empty stories: [] when story files don't have an explicit title in their meta object (the common case — Storybook auto-generates titles from file paths).

The manifest generator re-parses story files with loadCsf() and needs a makeTitle callback to compute the title. Previously, the fallback was 'No title', causing the CSF parser to generate wrong story IDs (e.g. no-title--logged-in instead of header--logged-in). Since extractStories filters by matching against the index entry IDs, none matched — resulting in empty stories: [].

The fix: always use entry.title from the story index, which was already correctly computed by the StoryIndexGenerator (via userOrAutoTitleFromSpecifier). There's no need to inspect the user's title from the file since the index already has the canonical answer.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

Caution

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

  1. Create a React Vite project with stories that have no explicit title in their meta (the common/default case)
  2. Enable features: { experimentalComponentsManifest: true } in .storybook/main.ts
  3. Run storybook build or storybook dev
  4. Check /manifests/components.json — stories should now be populated for all components, not just those with explicit titles

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>

Summary by CodeRabbit

  • Bug Fixes

    • Component manifest generation now reliably falls back to the entry title when story/metadata lacks an explicit title, ensuring stable, predictable story names.
  • Tests

    • Added tests confirming stories are populated using the entry title as a fallback when metadata has no explicit title.

@kasperpeulen kasperpeulen changed the title Fix manifest generation for stories without explicit title React: Fix manifest generation for stories without explicit title Feb 20, 2026
@kasperpeulen kasperpeulen changed the title React: Fix manifest generation for stories without explicit title React: Fix manifest stories empty when meta has no explicit title Feb 20, 2026
@nx-cloud
Copy link

nx-cloud bot commented Feb 20, 2026

View your CI Pipeline Execution ↗ for commit 5833e6b

Command Status Duration Result
nx run-many -t compile,check,knip,test,pretty-d... ❌ Failed 5m 23s View ↗

☁️ Nx Cloud last updated this comment at 2026-02-20 10:11:43 UTC

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 20, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

Changed the component manifest generator's CSF-title fallback to use the manifest entry's title when meta.title is absent. Added tests asserting stories are populated using the index entry title; tests duplicate the same assertion twice.

Changes

Cohort / File(s) Summary
Title fallback & tests
code/renderers/react/src/componentManifest/generator.ts, code/renderers/react/src/componentManifest/generator.test.ts
Updated loadCsf's makeTitle callback to return entry.title instead of a hardcoded 'No title'. Added tests that assert stories are populated with the index entry title when CSF meta lacks an explicit title (two identical test blocks were added).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)

Comment @coderabbitai help to get the list of available commands and usage tips.

@kasperpeulen kasperpeulen force-pushed the kasper/fix-manifest-stories-no-title branch from a097a67 to 9b85ba0 Compare February 20, 2026 09:49
When a story file has no explicit `title` in its meta (the common case),
the CSF parser received 'No title' as fallback, producing wrong story IDs
(e.g. `no-title--logged-in` instead of `header--logged-in`). These IDs
didn't match the index entries, so `extractStories` filtered them all out,
resulting in empty `stories: []` in the manifest.

Use `entry.title` from the story index as fallback instead.
@kasperpeulen kasperpeulen force-pushed the kasper/fix-manifest-stories-no-title branch from 9b85ba0 to 5833e6b Compare February 20, 2026 10:00
@kasperpeulen kasperpeulen added the patch:yes Bugfix & documentation PR that need to be picked to main branch label Feb 20, 2026
@storybook-app-bot
Copy link

Package Benchmarks

Commit: 5833e6b, ran on 20 February 2026 at 10:15:14 UTC

The following packages have significant changes to their size or dependencies:

@storybook/addon-vitest

Before After Difference
Dependency count 2 2 0
Self size 402 KB 391 KB 🎉 -11 KB 🎉
Dependency size 338 KB 338 KB 0 B
Bundle Size Analyzer Link Link

@kasperpeulen kasperpeulen merged commit a5282fc into next Feb 20, 2026
126 of 130 checks passed
@kasperpeulen kasperpeulen deleted the kasper/fix-manifest-stories-no-title branch February 20, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug ci:normal patch:yes Bugfix & documentation PR that need to be picked to main branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants