[wp-trac] [WordPress Trac] #51850: WP_Block: Inner blocks not being set
WordPress Trac
noreply at wordpress.org
Tue Nov 24 00:24:19 UTC 2020
#51850: WP_Block: Inner blocks not being set
--------------------------------------+-------------------------
Reporter: noisysocks | Owner: noisysocks
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 5.6
Component: Editor | Version: 5.6
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+-------------------------
Comment (by noisysocks):
See #51612 for some background context here. (Apologies, I should have
already linked to this ticket.)
We want to call `pre_render_block`, `render_block_data`, and
`render_block_context` in `WP_Block::render()` as it is not intuitive for
these "render" filters to be called in the constructor.
`WP_Block::$inner_blocks`, `WP_Block::$inner_html`, and
`WP_Block::$inner_content` are all derived from the result of calling
these filters.
This means we either have to:
1) Eagerly set the properties in the constructor and then re-set them in
`render()`; or
2) Make the properties lazy.
I opted for (2) because (1) involves doing unnecessary work in the
constructor and `WP_Block::render()` is a fairly warm path that is called
when viewing a post.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51850#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list