Skip to content

Post Comments block: Merge Comments Query Loop block #40521

@ockham

Description

@ockham

As per discussion with @mtias here and via DM, we should merge the Comments Query Loop block into the existing Post Comments block, with the following behavior:

  • If it doesn’t have any child blocks: Use the current Post Comments behavior, i.e. render the “monolithic” WP comment_form(). In the editor, we’ll display the placeholder.
  • If it has children: Use the Comments Query Loop behavior (i.e. render those child blocks).

If it’s newly inserted: insert child blocks as specified in its default template (as Comments Query Loop does already).

This means that the block will provide backward-compat for Post Comments (where it’s been used for existing themes); OTOH, it will provide the new functionality by default when newly inserted.

Quoting Matías:

The important things:

  • Replacing the block not creating a new one so we keep the namespace.
  • That existing uses of the PHP comments don’t break.
  • That inserting the block for the first time in a template uses the new set of blocks.

Note that there will be some edge cases that can lead to slightly awkward user experience, e.g. trying to edit a previously inserted empty Post Comments block (will show a placeholder in the editor). Matías said not to worry about these for 6.0.

The rest can be improved through iterations [after WP 6.0]
Including a “convert to blocks” and the addition of some nicely designed patterns

cc/ @WordPress/frontend-dx @priethor @gziolo

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Block] CommentsAffects the Comments Block - formerly known as Comments Query Loop[Block] Comments (legacy)The legacy mode of the Comments block (formerly known as Post Comments)

    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