WordPress / theme-experiments

Experimenting with themes made out of blocks.
GNU General Public License v2.0
546 stars 179 forks source link

TT1-Blocks: Update Query block in index template to use displayLayout instead of layout #293

Closed andrewserong closed 2 years ago

andrewserong commented 2 years ago

On a fresh install of Gutenberg, running in wp-env, I noticed that the current index.html template throws an error, due to the layout attribute being set to an invalid value (list):

This then throws an error in useAvailableAlignments at this line

image

This is because the layout attribute in this markup should be displayLayout, as layout is reserved for the Layout block support. The switch to displayLayout was introduced in https://github.com/WordPress/gutenberg/pull/31833 (back in May).

It seems that this error occurs because for the current markup the layout attribute is being used directly in the Query block here — and because the current markup includes the container div, it never gets migrated via a deprecation (which usually handles the migration from layout to displayLayout).

Just to double-check before we do any further work in Gutenberg, @jorgefilipecosta it looks like this markup was last updated in https://github.com/WordPress/theme-experiments/pull/276 — do you remember if the updated markup was copy + pasted or hand-edited? Just trying to work out whether the markup here had a typo, or if we need additional deprecations in Gutenberg to handle this case?

Steps to test

With Gutenberg activated, go to create a new page and copy and paste the existing markup for the wp:query block from this file into the code editor view. You should see the error message in the screenshot above when you switch back to the visual editor.

Edit the markup in the code editor view and copy paste the change in this PR over the existing markup. When you switch back to the visual editor view, there should no longer be an error. Or, alternately, spin up a new WP instance and use this PR to load the TT1-Blocks theme. When you open the site editor, there should be no errors in the Query block.

andrewserong commented 2 years ago

CC: @kjellr, too. I don't have access to add reviewers or labels to this repo 🙂

carolinan commented 2 years ago

Since the theme has not been updated since June I would expect there to be a large amount of compatibility issues. I don't think anyone frankly has time to update the theme until after we are all rested after 5.9.

Since Twenty Twenty-Two will be the new theme that is tested with Gutenberg, can we prioritize making that change instead?

carolinan commented 2 years ago

While I can merge it, I don't know how to tag it as a new release, and I can't release it to .org.

andrewserong commented 2 years ago

Thanks for merging @carolinan! And good to know that it's expected there'll be issues with TT1-Blocks until 11.9 comes out. I'll keep that in mind and focus more of my testing on TwentyTwentyTwo instead. Cheers!

andrewserong commented 2 years ago

As an aside, I just took a quick look at the TT2 templates and it looks like they don't have the same issue (the layout attribute in those templates appears to be set correctly) 👍

carolinan commented 2 years ago

With change, I meant, make sure that Gutenberg uses TT2 not tt1-blocks :) https://github.com/WordPress/twentytwentytwo/issues/133

jorgefilipecosta commented 2 years ago

Just to double-check before we do any further work in Gutenberg, @jorgefilipecosta it looks like this markup was last updated in #276 — do you remember if the updated markup was copy + pasted or hand-edited?

Hi @andrewserong, I'm sorry for the delay. The update was a mix of copy + paste and manual updates to reduce the diff.

andrewserong commented 2 years ago

Perfect, thanks for confirming @jorgefilipecosta, just wanted to make sure I didn't need to investigate the block itself further in the Gutenberg repo, and that confirms it. Cheers! 🙇