Description
I've registered a variation for a custom post type that sets an initial perPage value of 99 along with some other attributes.
When I first add the variation to the editor, I see:
<!-- wp:query {"query":{"postType":"person","perPage":99,"inherit":false},"namespace":"project/people"} -->
<div class="wp-block-query"></div>
<!-- /wp:query -->
I'm then presented an option to choose a pattern, which I expect. I select "Start blank" to choose one of the basic layouts provided for the query block. I then select "Title & Date" to populate a basic layout for the query.
This becomes:
<!-- wp:query {"queryId":1,"query":{"perPage":3,"pages":0,"offset":0,"postType":"person","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false},"namespace":"project/people"} -->
The originally selected variation's attributes have been overwritten by default attributes assigned to all core query variations.
My expectation is that the editor should respect the defaults I've applied to the initial variation.
Ideally, variations like "Title & Date" should only make changes to the layout of the Post Template block and not set any attributes in the query block. Less ideally, but also perfectly fine: it should merge itself with the first selected variation so that expectations can be set. Maybe an additional property of variations could be how they handle chaining?
In the current form, it seems that innerBlocks must be defined in the variation in order to have the variation attributes survive the initial insertion. The documentation kind of alludes to this, but it's not entirely clear.
Step-by-step reproduction instructions
- Register a block variation for
core/query with perPage set to 99.
- Insert the block variation.
- Select "Title & Date".
- Expect
perPage to be set to 99. See that it's set to 3.
Screenshots, screen recording, code snippet
No response
Environment info
- WordPress 6.2 with and without Gutenberg 15.7.0 active.
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
No
Description
I've registered a variation for a custom post type that sets an initial
perPagevalue of99along with some other attributes.When I first add the variation to the editor, I see:
I'm then presented an option to choose a pattern, which I expect. I select "Start blank" to choose one of the basic layouts provided for the query block. I then select "Title & Date" to populate a basic layout for the query.
This becomes:
The originally selected variation's attributes have been overwritten by default attributes assigned to all core query variations.
My expectation is that the editor should respect the defaults I've applied to the initial variation.
Ideally, variations like "Title & Date" should only make changes to the layout of the Post Template block and not set any attributes in the query block. Less ideally, but also perfectly fine: it should merge itself with the first selected variation so that expectations can be set. Maybe an additional property of variations could be how they handle chaining?
In the current form, it seems that
innerBlocksmust be defined in the variation in order to have the variation attributes survive the initial insertion. The documentation kind of alludes to this, but it's not entirely clear.Step-by-step reproduction instructions
core/querywithperPageset to99.perPageto be set to99. See that it's set to3.Screenshots, screen recording, code snippet
No response
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
No