Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reusable block isn't resolved inside columns #184

Open
MKlblangenois opened this issue Feb 5, 2024 · 3 comments
Open

Reusable block isn't resolved inside columns #184

MKlblangenois opened this issue Feb 5, 2024 · 3 comments

Comments

@MKlblangenois
Copy link

When I try to make a query to resolve innerBlocks of Core/Block (reusable block), I only got renderedHtml, but it doesn't resolve innerBlocks or attributes, but when I use it inside root of Gutenberg, GraphQL resolve innerBlocks block to display them as root too.

SCR-20240205-jtol

Step to reproduce:

  1. Create a block (on my case : heading + paragraph and group them)
  2. Save it has reusable
  3. Add a columns block
  4. Insert reusable block inside one column

This is what it looks like used on the same page:
SCR-20240205-jwnv

GraphQL result
{
  "data": {
    "testPage": {
      "editorBlocks": [
        {
          "name": "core/group",
          "innerBlocks": [
            {
              "name": "core/heading",
              "innerBlocks": []
            },
            {
              "name": "core/paragraph",
              "innerBlocks": []
            },
            {
              "name": "core/buttons",
              "innerBlocks": [
                {
                  "name": "core/button",
                  "innerBlocks": []
                },
                {
                  "name": "core/button",
                  "innerBlocks": []
                },
                {
                  "name": "core/button",
                  "innerBlocks": []
                },
                {
                  "name": "core/button",
                  "innerBlocks": []
                }
              ]
            }
          ]
        },
        {
          "name": "core/columns",
          "innerBlocks": [
            {
              "name": "core/column",
              "innerBlocks": [
                {
                  "name": "core/paragraph",
                  "innerBlocks": []
                }
              ]
            },
            {
              "name": "core/column",
              "innerBlocks": [
                {
                  "name": "core/block",
                  "innerBlocks": []
                }
              ]
            }
          ]
        },
      ]
    }
  },
}

Version:

  • wp-graphql-content-blocks: 2.0.0
  • Faust.js: 1.2.1
  • WPGraphQL: 1.20.0
@theodesp
Copy link
Member

theodesp commented Feb 6, 2024

Hey @MKlblangenois I think reusable blocks only resolve when using the editorBlocks field instead of the editorBlocks(flat: false) which you are using.

See: https://github.com/wpengine/wp-graphql-content-blocks/blob/main/includes/Data/ContentBlocksResolver.php#L57-L68

@theodesp
Copy link
Member

@MKlblangenois were you able to fix your issues?

@justlevine
Copy link
Contributor

Hey @MKlblangenois I think reusable blocks only resolve when using the editorBlocks field instead of the editorBlocks(flat: false) which you are using.

See: https://github.com/wpengine/wp-graphql-content-blocks/blob/main/includes/Data/ContentBlocksResolver.php#L57-L68

@theodesp is that a bug, known limitation, or intended behavior?

If it's one of the latter two, can this be documented somewhere? (If it is already, I can't find it)

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

No branches or pull requests

3 participants