Gutenberg error: Site doesn't support Template block

Hi,

I have the following code:

<div class="band"><Loop post_type="computer_media" taxonomy="model" terms="ts-2068" orderby=title order=asc><div class="item"><If user_role includes value="administrator"><a href="{Field edit_url}" target="_new">Edit</a></If><a href="{Field url}" class="card"><If field image exists>
  <Set name=teaser_image><Field image_url /></Set>
<Else if field="media-type" value="Diskette"/>
  <Set name=teaser_image>http://localhost/wp-content/uploads/2024/07/elephant-front.jpg</Set>
<Else />
  <Set name=teaser_image>http://localhost/wp-content/uploads/2024/07/SCR-20240721-iyce-e1721569264907.png</Set>
</If><div class="thumb" style="background-image: url({Get teaser_image});"></div><article><h4><Field title /></h4><span class="computertag"><Field media-type /></span><p><Field excerpt auto=true /></p></article></a></div></Loop></div>

I edited the code to include paging and PaginateButtons, like this:

<div class="band"><Loop post_type="computer_media" taxonomy="model" terms="ts-2068" orderby=title order=asc paged=30><div class="item"><If user_role includes value="administrator"><a href="{Field edit_url}" target="_new">Edit</a></If><a href="{Field url}" class="card"><If field image exists>
  <Set name=teaser_image><Field image_url /></Set>
<Else if field="media-type" value="Diskette"/>
  <Set name=teaser_image>http://localhost/wp-content/uploads/2024/07/elephant-front.jpg</Set>
<Else />
  <Set name=teaser_image>http://localhost/wp-content/uploads/2024/07/SCR-20240721-iyce-e1721569264907.png</Set>
</If><div class="thumb" style="background-image: url({Get teaser_image});"></div><article><h4><Field title /></h4><span class="computertag"><Field media-type /></span><p><Field excerpt auto=true /></p></article></a></div></Loop></div>
<PaginateButtons />

Saved the edits, viewed the page: it works out fine. Attempt to edit the page and I get an error message that my site doesn’t support the Tangible Template block and I get the option to install it.

The first time through this experience, attempting to install it apparently removed the Tangible Template plugin (that was a moment of panic, when suddenly none of my pages worked). Re-installed Loops & Logic, all is well.

Attempted to add the pagination feature and the same result: displays ok, editing the page throws an error.

I can’t say “nothing has changed” with my site since installing TT/L&L (I’ve been using it for years).

But I did at least confirm that adding paged=30 crashes the editor. I only know this bc I added <PaginateButtons /> and forgot to add the paged option to my loop.

This isn’t mission critical for my but a nice-to-have that would make some long pages easier to use.

Thank you for reporting the issue.

I was able to reproduce the issue, not with pagination but with the error saying the Template block is not supported.

image

I found that the Template block was prevented from loading in the editor because one of its dependencies used for AJAX was not being loaded. The root cause was that something changed in the way the block editor loads its JS/CSS assets, where the dependency must now be registered twice: using admin_enqueue_scripts and also enqueue_block_editor_assets. The first makes the dependency available for general admin usage, and the second for loading within the editor iframe.

It’s been solved here: Fix Gutenberg breaking backward compatibility: AJAX script must be re… · TangibleInc/template-system@06c2199 · GitHub

The fix will be released in the next version soon. If you’d like to try it before that, here’s the zip file of the newest template system.

OK, this should be fixed in the newly released version 4.1.7.

2 Likes