Skip to content

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

@ndiego

Description

@ndiego

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

Metadata

Metadata

Assignees

Labels

[Block] Query LoopAffects the Query Loop Block[Type] BugAn existing feature does not function as intended[Type] RegressionRelated to a regression in the latest release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions