Repository navigation
UI: add displayNames - #80132
UI: add displayNames#80132simison wants to merge 3 commits into
Conversation
|
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. |
200d0d6 to
11c3526
Compare
|
Size Change: +1.19 kB (+0.02%) Total Size: 7.73 MB 📦 View Changed
|
There was a problem hiding this comment.
Are the changes in this file actually making a difference?
|
These things are quite finicky, and it's hard to have a pattern that "works forever". Even since the last time I checked, I think the behavior changed to switch which name is chosen for display in exports like this: // This pattern used to show `TabList` as the display name,
// which kind of avoided the need to set explicit display names.
export const List = forwardRef< HTMLDivElement, TabListProps >(
function TabList(The docgen has historically been very sensitive to how everything is structured in our source code at the AST level, and of course this has the possibility to change over time. In the past, we've seen that setting explicit
Here, I noticed that this causes the prop type extraction to break in cases like Also please update the contributing docs once we have a working pattern for these 🙏 |
|
As an idea, could we look at fixing (patching) this in a way that is more specific about Storybook code snippets, so that it doesn't have other involuntary consequences? |
I'll look if I can find some alternative ways. Lemme know if you have ideas! That said, React DevToolsWithout
|
Set explicit public displayName values on namespaced subcomponents so React DevTools and Storybook source snippets show names like Card.Root instead of internal export names.
11c3526 to
fa6cdd0
Compare
|
Flaky tests detected in fa6cdd0. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/29492703719
|
|
Tangential, but I ran into issues when setting display names on reexports of primitive components on higher-level components. Not sure what would be reasonable here 😕 |







What?
Adds
displayNameeverywhere in UI package.Combined with #80129 which deals with
Fragments in the code examples, this improves code example readability in the storybook, and also when folks use tools like React DevTools.See also docs;
gutenberg/packages/components/CONTRIBUTING.md
Line 252 in a65fc3e
Why?
Cleaner code previews and copy-paste for docs consumers.
How?
Testing Instructions
Run
npm run storybook:devBrowse around code examples.
Testing Instructions for Keyboard
Screenshots or screencast
Before
After
(
Fragmentin screenshot is gone because of #80129)Use of AI Tools
Yes