-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Storybook: Update control types from null
to undefined
#67581
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. |
Size Change: 0 B Total Size: 1.83 MB ℹ️ View Unchanged
|
Flaky tests detected in f7126d2. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12181662294
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intent of type: null
is to suppress the rendering of a control, and I'm seeing that type: false
is the correct replacement for that:
Specifying false will prevent the control from rendering.
Makes sense. Updated to |
@@ -23,7 +23,7 @@ const meta: Meta< typeof NumberControl > = { | |||
step: { control: { type: 'text' } }, | |||
suffix: { control: { type: 'text' } }, | |||
type: { control: { type: 'text' } }, | |||
value: { control: null }, | |||
value: { control: { type: 'text' } }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: I thought this one made more sense than what we had before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The general pattern is that we suppress the value
control when the story is implemented in controlled mode. It especially doesn't work in this implementation because the value
prop will be overridden by the template's internal value state anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 7381add.
Shipping when green.
Thanks, @mirka, this is ready for another look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should revert the NumberControl change, but otherwise looks good 🚀
@@ -23,7 +23,7 @@ const meta: Meta< typeof NumberControl > = { | |||
step: { control: { type: 'text' } }, | |||
suffix: { control: { type: 'text' } }, | |||
type: { control: { type: 'text' } }, | |||
value: { control: null }, | |||
value: { control: { type: 'text' } }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The general pattern is that we suppress the value
control when the story is implemented in controlled mode. It especially doesn't work in this implementation because the value
prop will be overridden by the template's internal value state anyway.
@mirka it seems like we should have gone with Going to file a PR to move back to |
See #67646 |
What?
This PR updates
null
control types toundefined
.Part of #67574
Why?
Preparatory work for upgrading Storybook v8 -
null
controls cause type errors with v8.How?
Just updating the types.
Testing Instructions
Verify Storybook builds well and test a few controls to ensure they work the same way.
Testing Instructions for Keyboard
Same
Screenshots or screencast
None