-
Notifications
You must be signed in to change notification settings - Fork 219
Define parent in registerCheckoutBlock #4591
Conversation
Size Change: +7 B (0%) Total Size: 1.13 MB
ℹ️ View Unchanged
|
f461fd5
to
a3ec41c
Compare
if ( options?.configuration ) { | ||
assertOption( options, 'configuration', 'object' ); | ||
registerExperimentalBlockType( blockName, { | ||
...options.configuration, | ||
category: 'woocommerce', | ||
parent: [], |
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.
Can't we extrapolate this from options.areas
?
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.
It doesn't seem like we need to. Those areas still work.
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'm not sure I understand?
I mean that instead of waiting for 3PD to pass the parent value, we implicitly provide it from what's in options.areas
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.
Parent should be empty. We're not accepting this prop from 3PD, it's being overwritten as []
.
3PD use the area prop to define where they want blocks to appear. Not parent.
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.
Ah right, sorry. My understanding is that having []
would disable the block from all inserters.
I don't understand yet how can we show sample block only on our innerBlocks, is it because allowedBlocks
override parent
?
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.
Yup it certainly looks that way. My testing instructions cover this—sample block can be inserted into the contact information section.
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.
Yeah, I can see that. Approved.
Update
registerCheckoutBlock
to include an emptyparent
property. This ensures a block registered viaregisterCheckoutBlock
is only available in defined areas, not globally.Fixes #4492
How to test the changes in this Pull Request:
npm start
).