Skip to content

core/post-content patterns fail to render preview on page creation of patterns referenced within them #45586

Closed

Description

@aplauche

Description

I noticed I can create page template patterns (that autoload on page creation) fine by building out content in the editor and then copying the code, but I'd like to create these core/post-content patterns with just a few references to my other section style patterns (otherwise there is a lot of repeating the same pattern multiple places making it hard to maintain). When I try to do this manually it breaks the preview when creating a new page. You can see that the "page text basic" renders partly the block markup, but not the included patterns.

For reference, the patterns still work perfectly when you click to insert them, it is just the preview that does not work. I can also insert them, the switch to code, copy everything and use that as a core/post-content pattern and the preview works again. It is just the pattern reference within preview that is breaking.

Full disclosure: this is happening in a custom theme, so could be a syntax issue, but the behavior of the pattern working but not the preview seemed like a possible bug to me, so wanted to flag.

Step-by-step reproduction instructions

  1. add a standard pattern to your block theme like "hero section"
  2. create a pattern with Block Types: core/post-content
  3. Add the standard pattern to this template like so <!-- wp:pattern {"slug":"example/hero"} /-->
  4. Create a new page and the preview does not seem to render the pattern

Screenshots, screen recording, code snippet

image

image (1)

image (5)

Environment info

  • WordPress 6.1
  • Custom Theme This could an issue with the way my custom theme is setup, but the patterns still work perfectly so the behavior seems like a potential bug and wanted to flag

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

Activity

  1. added
    Needs TestingNeeds further testing to be confirmed.
    [Feature] PatternsA collection of blocks that can be synced (previously reusable blocks) or unsynced
    on Nov 7, 2022
  2. ndiego commented on Nov 8, 2022

    @ndiego
    Member

    Hi @aplauche, this is a known issue and has been fixed in the latest version of Gutenberg. See the related PR here: #44784.

    Can you try testing again using Gutenberg 14.4? I have tested on my end using the Twenty Twenty-Three theme, and the nested patterns are displaying as expected. Thanks!

  3. aplauche commented on Nov 8, 2022

    @aplauche
    Author

    @ndiego Thanks for the info! Just tested and can confirm all is working perfectly with Gutenberg 14.4. Closing now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TestingNeeds further testing to be confirmed.[Feature] PatternsA collection of blocks that can be synced (previously reusable blocks) or unsynced

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions