Manifests: Use correct story name#33709
Conversation
|
View your CI Pipeline Execution ↗ for commit a765607
☁️ Nx Cloud last updated this comment at |
📝 WalkthroughWalkthroughStory extraction in the React component manifest was changed to iterate using story export keys and story objects; name resolution now prefers runtime story.name with fallback to storyNameFromExport(export). Code-snippet lookup and error payloads now use the export key and include story id/name; tests updated accordingly. Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
✨ Finishing touches
Comment |
There was a problem hiding this comment.
Pull request overview
This PR fixes the story names displayed in component manifests to use properly formatted names (e.g., "Logged In" instead of "LoggedIn").
Changes:
- Modified manifest generator to use
story.name(which is already properly formatted from the runtime index) with a fallback tostoryNameFromExport(storyExport)for backward compatibility - Updated test expectations to reflect the corrected story name formatting
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| code/renderers/react/src/componentManifest/generator.ts | Updated to use story.name instead of the raw export name, with proper fallback logic |
| code/renderers/react/src/componentManifest/generator.test.ts | Updated test snapshots to expect properly formatted story names |
…m:storybookjs/storybook into jeppe/use-correct-story-name-in-manifests
kasperpeulen
left a comment
There was a problem hiding this comment.
LGTM! Good catch - this should have used storyNameFromExport from the start.
Minor optional nit: the id and name computation is duplicated in both try/catch branches. Could extract it before the try block, but not a blocker.
|
To add some context: this is the same logic used in |
…me-in-manifests Manifests: Use correct story name (cherry picked from commit 4884b33)
Closes #
What I did
Fixed a bug where a story's name in the manifest would always be its export name, and not its actual human-readable name, either from the custom
nameproperty, or using auto-naming that adds spaces.This aligns the manifest with the same logic used in
normalizeStory.tsandStoryIndexGenerator.Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
No manual testing needed - the unit tests verify that story names are correctly converted (e.g.,
LoggedIn→Logged In).Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsMake 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/coreteam 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
Refactor
Tests