-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Jetpack Blocks: Add the jetpack contact form blocks to the preset #29150
Conversation
How can I observe the brokeness without this change? :-) |
@simison I want to make the following change to jetpack Automattic/jetpack#10844 Without it this PR will not work as expected. |
I"m all for de-duplicating information, but TBH, adding all those child blocks to |
I agree that if the presence of the parent block necessarily means that its child blocks are also included, |
04e9416
to
a47dcad
Compare
@tyxla, @gititon, @simison and @ockham. The only reason why things work now is because we merge the current default blocks with the list in the index. The list of default blocks is hard coded in the Jetpack Gutenberg class. Here is the PR that cleans it up on jetpack. Automattic/jetpack#10844 |
How come? Gutenberg has the concept of nested blocks AKA inner blocks, AKA child blocks - blocks that can only be inserted as nested blocks inside a limited set of parent blocks. Regardless of how we call them, it is a concept that exists in Gutenberg core, and we use it as well. I don't see how that is a mess. I think that any block should be able to register child blocks, and block availability wouldn't have to know about them. That would change only in the event where we need to hide certain nested blocks for reasons (pain plans, etc.), and I don't see such a use case yet. Personally, I think treating the nested blocks as regular blocks makes things more messy. |
Yes there are such concepts as inner blocks but the inner blocks could have more then one parent. In gutenberg inner blocks define who the parent is and not the other way around. In someways it would make more sense to not include the InnerBlocks still need to be register individually. If we only had to register the parent block to get the inner blocks I think what we currently have would make sense. We are trying to separate the block definitions from when we register them. So having some block in the index and not the other ones doesn't make sense to me. The list is not complete. The only reason why things work now is because of a bug. That I am trying to get rid of on the jetpack side. See Automattic/jetpack#10844 For example if I am working on an inner block that I want to beta tests before I release. How do we do that right now? |
a47dcad
to
84ed8fe
Compare
I've come around and agree with Enej that each block should be listed explicitly. This would ensure that there is a single source of truth for the blocks that are included, as opposed to some blocks being loaded by index.json and others being included as part of the Jetpack default blocks. As Enej explained to me, this would also facilitate beta testing inner blocks before they are added to production. That said, I propose we indent the "child blocks" beneath the Contact Form block. While the whitespace will be inert, it will clearly distinguish these blocks as being child blocks of the Contact Form block as opposed to being "top level" blocks. This would make block inclusions explicit while at the same time keeping the list looking organized. E.g.,
|
I'd prefer to go YAGNI with this. Do we have a real use case where this would be useful?
This is likely the only good reason I see that could justify the added complexity. I wonder if we could find a better way...
What if a block can be a child block to multiple parent blocks? |
I'm closing because I believe this has been superseded by other work. If that's not the case, please reopen. |
Changes proposed in this Pull Request
Testing instructions
We missed this in the previous release and allowed all the blocks to be loaded as they were.