-
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: Log warning()
when in dev mode
#66568
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.81 MB ℹ️ View Unchanged
|
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.
LGTM 👍 Nice one @mirka 🚀
A bit of a bummer that the warning might be lost among other pre-existing ones:
Co-authored-by: mirka <[email protected]> Co-authored-by: tyxla <[email protected]>
What?
Ensure that console warnings using
@wordpress/warning
are also properly logged in Storybook when in dev mode.Why?
warning()
messages were not logged in Storybook, even when in dev mode. This is inconvenient because we often check for these things using Storybook.How?
warning()
checks for dev mode using theSCRIPT_DEBUG
global.gutenberg/packages/warning/src/index.ts
Lines 6 to 9 in 7714bce
We should inject this with Webpack, similar to how the wp packages are built:
gutenberg/tools/webpack/shared.js
Line 75 in 7714bce
Testing Instructions
See the "With Actions" story for Snackbar. Adding multiple actions to the
actions
array should log a console warning.gutenberg/packages/components/src/snackbar/index.tsx
Lines 119 to 123 in 7714bce
Alter the story args here so there are multiple actions:
gutenberg/packages/components/src/snackbar/stories/index.story.tsx
Lines 59 to 64 in 7714bce