Skip to content

Query Loop: When a variation is picked via BlockVariationPicker component, the post type is always "Post" instead of the one defined via the variation #46367

@gigitux

Description

@gigitux

Description

When a Query Loop variation is picked via the BlockVariationPicker component, the post type is "Post" instead of the one defined via the variation.
This happens because the check at line 144 is wrong. We have to reverse it.

I noticed this issue working on the Product Query woocommerce/woocommerce-blocks#7852.

Step-by-step reproduction instructions

  1. Create a Query Loop variation that has as post type "Page" (you can use this code).
  2. Add the Query Loop block.
  3. Click Start Blank.
  4. Select the variation created previously. If you copy-pasted the code above, the name of the variation is "Query Loop variation".
  5. In the right sidebar, you can see that the selected post type is "Post", instead of "Page".

Screenshots, screen recording, code snippet

Screen.Capture.on.2022-12-07.at.16-28-41.mov

Environment info

  • WordPress 6.1
  • Gunteberg trunk version

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

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions