Skip to content

Block variations registered on the server can get overwritten in the client #60298

@joemcgill

Description

@joemcgill

Description

As reported in https://core.trac.wordpress.org/ticket/60856, the core/group block does not register any of its variations on the server, but instead adds them at runtime in the client. This means that any variations registered on the server via filters or other means get overwritten when the core/group block is initialized. I suspect this behavior is consistent with all blocks that are adding variations, which likely includes this whole list.

I would expect that any variations supplied by the server would be added to the variations added to the block in JS.

Step-by-step reproduction instructions

  1. Add a block variation to the group block using the get_block_type_variations filter in PHP.
  2. Confirm that the variation is being supplied by the server by inspecting the output of get_block_editor_server_block_settings(), which is used to bootstrap block types from the server.
  3. Load the editor and inspect the block definition in the console: wp.blocks.getBlockTypes().filter( (block) => block.name === 'core/group' )
  4. See that the variation supplied by the server is no longer present.

Screenshots, screen recording, code snippet

No response

Environment info

No response

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

[Feature] Block VariationsBlock variations, including introducing new variations and variations as a feature[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions