bobbingwide / fizzie

Fizzie theme - a Full Site Editing theme using Gutenberg blocks
9 stars 1 forks source link

The recursive template parts in Fizzie break Gutenberg's Template parts block #49

Closed bobbingwide closed 1 year ago

bobbingwide commented 3 years ago

I wanted to test my rich text localization ( l10n) logic in Gutenberg 9.5.1 so I created a template part called i18n-rich-text.html. I tried to load it using the Template part block in a page, while in the bb_BB locale.

But in s.b/wp56 I got This block has encountered an error and cannot be previewed even before I had a chance to pick the template part. I believe this was due to the Template part block trying to display Previews of the blocks and failing to detect recursion.

Note: In s.b/wp55/tt1 - with the recursive template parts I'd created for Twenty Twenty-One Blocks it causes Chrome to time out. image

Clearly there's a problem with the Template parts block ( core/template-part ). But what should I do as a workaround?

bobbingwide commented 3 years ago

Workaround

Edit one of the template parts so that it doesn't go recursive. This can be done by removing the blank space between the block name and the attributes. eg


<ul>
    <li>Issue-30 test case.
    <!-- wp:template-part{ "slug": "issue-27", "theme": "fizzie" } /-->
    </li>
</ul>
bobbingwide commented 1 year ago

Template parts can no longer be inserted in the block editor. They can be inserted in the Site Editor. I reverted issue-30.html and tested in the Site Editor. The recursion detection logic in Gutenberg worked. It was fixed in March 2021.