Storybook: Fix component descriptions in manifest files#77112
Conversation
|
Size Change: 0 B Total Size: 7.75 MB ℹ️ View Unchanged
|
|
Flaky tests detected in d8531bc. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/24578852248
|
See: #77382 |
8169c59 to
d8531bc
Compare
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Marking this ready for review so that we can improve component documentation for MCP being introduced in #77159. The Storybook upgrade is stalled in #77382 due to a couple upstream Storybook bugs. In d8531bc I added lint enforcement to enforce the pattern for the components to be picked up correctly. It might also be something we want to apply to |
mirka
left a comment
There was a problem hiding this comment.
Also smoke tested some prop tables in Storybook, no issues 👍
* Storybook: Fix component descriptions in manifest files * Simplify to directory import * Fix Popover import * Use consistent import semantics in stories * Use no-restricted-imports to forbid import syntax Co-authored-by: aduth <aduth@git.wordpress.org> Co-authored-by: mirka <0mirka00@git.wordpress.org>
What?
Fixes published Storybook component manifest to ensure correct component descriptions are included.
Example: https://wordpress.github.io/gutenberg/manifests/components.html
"A badge component for displaying labels with semantic intent" is the wrong description.
Draft:
We should do one of the following:
Why?
So that component descriptions are accurate based on implementation documentation.
How?
These are documented correctly in code, so it appears to be an issue with how Storybook resolves components.
The proposed fix was based on an observation of how this wasn't problematic with the output of some components that already used this approach for importing components from its source (
Card,Collapsible,Dialog,Notice). It's a hacky fix around how Storybook (more specifically, likelyreact-docgen-typescript) is unable to follow the imports. The hypothesis is that it chooses Badge description because the previous code points to the root barrel index and Badge is the first export in that file.I went down a long rabbit hole of trying to find related issues and release notes about this problem in related packages. I'll plan to share those more completely as this takes shape. But my attempts to update to newer versions were unsuccessful due to some errors about package resolution. And while newer versions support Vite 8+, there may be some blockers for us to use that (e.g. Node/ESM support).
Testing Instructions
Verify manifest output:
npm run storybook:buildopen storybook/build/manifests/components.html)AlertDialog.Rootand other@wordpress/uicomponentsUse of AI Tools
Used Claude Code + Opus 4.6 in the troubleshooting process and implementing the import workaround based on the working convention of other components.