-
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
Fix issue #20069: Block Editor: Warning when rendering InnerBlocks #20082
Fix issue #20069: Block Editor: Warning when rendering InnerBlocks #20082
Conversation
@ragnarokatz I'm wondering if it is possible to minimize changes by avoiding having to refactor the child components and constructing the containers twice. It might be possible to use the spread operator on just the experimental props for the container. Try this? const __experimentalContainerProps = rootClientId ? {} : { hasPopover: __experimentalUIParts.hasPopover };
<Container
ref={ ref }
className={ classnames(
'block-editor-block-list__layout',
className
) }
{ ...__experimentalContainerProps }
> |
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.
Hey @ragnarokatz, Thanks for taking this on. I think this code could be simplified if the prop were defined like this:
hasPopover={ Container === 'div' ? undefined : __experimentalUIParts.hasPopover }
edit: ah, only just realised @yansern had a similar proposal!
@talldan @yansern thank you for your suggestions. @talldan I tried your suggestion first, since it is the least amount of code changes. The warning is still there. I tried a similar approach last night with @yansern I gave yours ago, and it works. I will push the updated changes soon. I learned something new today! The spread operator -> |
6665cdc
to
a5b51bd
Compare
…t to stop adding hasPopover prop to Container when Container is 'div'
a5b51bd
to
3be41fd
Compare
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.
Thanks for the quick fix.
Fixes #20069
Description
Implement conditional rendering for Block Editor's
BlockList
component to stop addinghasPopover
prop toContainer
whenContainer
is'div'
.How has this been tested?
Screenshots
Before:
After:
Types of changes
Bug fix, fixes a warning that was being fired from the developer console.
Checklist: