TT1-Blocks: Update Query block in index template to use displayLayout instead of layout #293
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On a fresh install of Gutenberg, running in
wp-env
, I noticed that the currentindex.html
template throws an error, due to thelayout
attribute being set to an invalid value (list
):This then throws an error in
useAvailableAlignments
at this lineThis is because the
layout
attribute in this markup should bedisplayLayout
, aslayout
is reserved for the Layout block support. The switch todisplayLayout
was introduced in WordPress/gutenberg#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 containerdiv
, it never gets migrated via a deprecation (which usually handles the migration fromlayout
todisplayLayout
).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? 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.