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

Query: Editor crashes when query attribute includes categoryIds or tagIds and the layout attribute is applied #51308

Closed
ndiego opened this issue Jun 7, 2023 · 4 comments · Fixed by #51311
Assignees
Labels
[Block] Query Loop Affects the Query Loop Block [Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release

Comments

@ndiego
Copy link
Member

ndiego commented Jun 7, 2023

Description

I believe this issue is related to changes made in #49050, perhaps here.

See the code example below. When you have a Query block that includes the deprecated sub-attributes categoryIds and/or tagIds of the query attribute, and then the layout attribute is set, the Editor will crash. This is a particularly problematic regression because block themes in the WordPress.org repository have patterns built with these attributes.

This issue is specific to trunk and 16.0 RC1. Gutenberg 15.9.1 works correctly.

Step-by-step reproduction instructions

  1. Make sure you are using trunk or 16.0 RC1
  2. Create a new page and add the following code to the Code Editor.
  3. Switch to the Visual Editor and see the Editor crash.

Screenshots, screen recording, code snippet

<!-- wp:query {"queryId":2,"query":{"perPage":3,"pages":0,"offset":0,"categoryIds":[],"tagIds":[],"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false,"taxQuery":{"category":[1]}},"layout":{"type":"constrained"}} -->
<div class="wp-block-query"><!-- wp:post-template -->
<!-- wp:post-featured-image /-->

<!-- wp:post-date /-->

<!-- wp:post-title /-->
<!-- /wp:post-template -->

<!-- wp:query-pagination -->
<!-- wp:query-pagination-previous /-->

<!-- wp:query-pagination-numbers /-->

<!-- wp:query-pagination-next /-->
<!-- /wp:query-pagination -->

<!-- wp:query-no-results -->
<!-- wp:paragraph {"placeholder":"Add text or blocks that will display when a query returns no results."} -->
<p></p>
<!-- /wp:paragraph -->
<!-- /wp:query-no-results --></div>
<!-- /wp:query -->

Environment info

  • Gutenberg 16.0 RC1
  • WordPress 6.2.2

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@ndiego ndiego added [Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release [Block] Query Loop Affects the Query Loop Block labels Jun 7, 2023
@ndiego
Copy link
Member Author

ndiego commented Jun 7, 2023

@tellthemachines I think this is just a deprecation file issue, but any additional thoughts on this?

@bgardner
Copy link

bgardner commented Jun 7, 2023

I can confirm this is an issue, and thanks to @ndiego, will be pushing out an update to my Powder theme which removes the deprecated sub-attributes ahead of the Gutenberg 16.0 release just_in_case.

@andrewserong
Copy link
Contributor

andrewserong commented Jun 8, 2023

It looks like migrateToConstrainedLayout is missing a return attributes statement for blocks that have layout that's already in the correct shape. I can put up a quick PR.

@andrewserong
Copy link
Contributor

andrewserong commented Jun 8, 2023

I have a fix up over in #51311. Thanks for opening the issue and providing the test markup!

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jun 8, 2023
@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Query Loop Affects the Query Loop Block [Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants