-
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
Navigation Editor: show a warning when trying to save unsupported blocks #35993
Navigation Editor: show a warning when trying to save unsupported blocks #35993
Conversation
Size Change: +766 B (0%) Total Size: 1.08 MB
ℹ️ View Unchanged
|
.filter( ( { block } ) => ! isBlockSupportedInNav( block ) ) | ||
.map( ( { block } ) => block.name ); | ||
if ( unsupportedMenuItems.length ) { | ||
logWarning( |
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.
This function exists for development purposes, to show warnings in the development mode related to code.
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.
@gziolo Ah, I see. It's not going to work in the browser because process.env.NODE_ENV
won't be defined.
Should we simply use console.warn
instead?
Do you have a better alternative?
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.
Yes, console.warn
should work. We might have usage of it also in other places.
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.
…e it's not going to work in the browser. It's intended to be used with Node.
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 👏🏻
Thank you for the review, @draganescu ! |
Description
Navigation editor only processes a subset of blocks in the editor, silently omitting anything that's not supported.
It would be useful to log a warning and make any problems there apparent.
Fixes #35045.
How has this been tested?
I had trouble reproducing this, so I've just replaced
gutenberg/packages/edit-navigation/src/store/utils.js
Line 80 in 92bf5e6
with
to emulate unsupported blocks.
3. Open the menu in the Navigation editor. Try to save it.
4. You should see a similar message in your browser console:
Types of changes
New feature
Checklist:
*.native.js
files for terms that need renaming or removal).