Skip to content
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

Blocks: Use do_blocks to render core blocks content #8019

Merged
merged 1 commit into from
Jul 19, 2018

Conversation

aduth
Copy link
Member

@aduth aduth commented Jul 18, 2018

Fixes #6662

This pull request seeks to resolve an issue where shared blocks which contain InnerBlocks content (e.g. Columns) would not render its content on the front-end.

Implementation notes:

The root cause is that we were parsing the content as blocks and relying on the parsed block's innerHTML to be the render output. For nested blocks, the innerHTML does not include its child block contents. It is also not possible to reconstruct this block on the server.

Instead, the approach here simply treats the shared block's content as if it were a post containing blocks, leveraging the do_blocks function to pass its content string. This should support not only inner blocks, but also dynamic block replacement (e.g. shared blocks in shared blocks).

This may also have a performance benefit, avoiding a costly full content parse in lieu of do_blocks simpler implementation.

Testing instructions:

Repeat steps to reproduce from #6662, noting there are no issues in the display of the shared Columns block on the front-end of the site.

@aduth aduth added [Feature] Blocks Overall functionality of blocks [Feature] Nested / Inner Blocks Anything related to the experience of nested/inner blocks inside a larger container, like Group or P labels Jul 18, 2018
@aduth aduth added this to the 3.3 milestone Jul 18, 2018
@aduth aduth requested a review from noisysocks July 18, 2018 13:37
@tofumatt tofumatt self-requested a review July 19, 2018 13:29
Copy link
Member

@tofumatt tofumatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally and seems to work for me!

I think this is worth landing now but e2e tests for this would be good in the future.

@aduth
Copy link
Member Author

aduth commented Jul 19, 2018

I think this is worth landing now but e2e tests for this would be good in the future.

Agree! I created an issue at #8054 to track.

@aduth aduth merged commit 6efbcfb into master Jul 19, 2018
@tofumatt tofumatt deleted the fix/6662-render-core-block branch July 19, 2018 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Blocks Overall functionality of blocks [Feature] Nested / Inner Blocks Anything related to the experience of nested/inner blocks inside a larger container, like Group or P
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shared block not working with columns
2 participants