Post Comments block: Merge Comments Query Loop block#40522
Post Comments block: Merge Comments Query Loop block#40522
Conversation
52fcc45 to
2027143
Compare
|
Size Change: +437 B (0%) Total Size: 1.23 MB
ℹ️ View Unchanged
|
|
Some minor updates:
These two changes would solve all problems with the static-dynamic behavior. I'll update the list of next steps that @ockham posted in the issue. |
8ace6c6 to
441dfb7
Compare
29675b6 to
f2e5bc2
Compare
This reverts commit aef1054.
|
Added variation to inject the inner block template on block insertion. We are using this method because it was impossible to know when |
|
If I create a (childless) Post Comments block ( The console shows I believe that this is because the merged block’s I think the problem is that we’re unconditionally rendering the wrapping I've tried to fix this with some logic as follows: diff --git a/packages/block-library/src/post-comments/save.js b/packages/block-library/src/post-comments/save.js
index 94b8adfadc..d556d66621 100644
--- a/packages/block-library/src/post-comments/save.js
+++ b/packages/block-library/src/post-comments/save.js
@@ -1,12 +1,16 @@
/**
* WordPress dependencies
*/
-import { InnerBlocks, useBlockProps } from '@wordpress/block-editor';
+import { useInnerBlocksProps, useBlockProps } from '@wordpress/block-editor';
+import { Children } from '@wordpress/element';
export default function save( { attributes: { tagName: Tag } } ) {
- return (
- <Tag { ...useBlockProps.save() }>
- <InnerBlocks.Content />
- </Tag>
- );
+ const blockProps = useBlockProps.save();
+ const innerBlocksProps = useInnerBlocksProps.save( blockProps );
+
+ if ( Children.count( innerBlocksProps.children ) === 0 ) {
+ return;
+ }
+
+ return <Tag { ...innerBlocksProps } />;
}Notes:
My patch isn't quite working yet: It seems that even with the childless Post Comments block, To be continued. |
|
Per discussion on the issue, and due to the problems we've encountered, we've decided to stop working on this for now. We'll revisit after WP 6.0. |


What?
Merge the Comments Query Loop block into the Post Comments block.
Why?
See #40521 for details.
How?
TBD
Testing Instructions
TBD
Screenshots or screencast
TBD