Skip to content

[Query Loop]: Improve block variations in blocks with pattern setup flow #42533

@ntsekouras

Description

@ntsekouras

Description

Currently in Query Loop and Template Parts we use the pattern setup flow, where a user can choose and insert directly a semantic pattern or some default block variation(scope: block).

Right now we have only one variation that is exposed to the inserter(Posts List), but that is subject to change with this issue. The problem here is that patterns and the scope block variations have different attributes and this results to override the Posts List variation attributes.

The problem is for any block that uses pattern setup flow like Template Part, but is not visible there because that block's variations only contain the area attribute which is also the one used in calculating the active variation(in isActive function).

We need to find a good way to preserve some important attributes(or part of them if is an object like query) and in general make sure that these preserved attributes do no affect the presentation/design.

This also applies to the replace with pattern flow.

Should we remove Posts List variation for now? It seems it just adds unnecessary confusion right now.

Related: #32268

Step-by-step reproduction instructions

  1. In post editor insert a Posts List variation
  2. Select any default block variation or a pattern(patterns usually don't contain sticky: 'exclude', like Posts List do)
  3. Observe that the sticky option is not set to exclude like we declare here: https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/query/variations.js#L51

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Block] Query LoopAffects the Query Loop Block[Feature] Block VariationsBlock variations, including introducing new variations and variations as a feature[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