TylerBarnes / using-gatsby-source-wordpress-experimental

A starter for the upcoming gatsby-source-wordpress@v4
https://www.npmjs.com/package/gatsby-source-wordpress-experimental
MIT License
86 stars 29 forks source link

Cant get Columns of WpCoreColumnsBlock #11

Closed Jehu closed 4 years ago

Jehu commented 4 years ago

Hi,

I can't get the columns inside "WpCoreColumnsBlock" Here's my query:

query posts($slug: StringQueryOperatorInput) {
  allWpPage(filter: {slug: $slug}) {
    nodes {
      slug
      uri
      blocks {
        __typename
        ... on WpCoreColumnsBlock {
          name
[...]
        }
      }
    }
  }
}

At WordPress i can query 'innerBlocks' with GraphiQL, but this property is not available in Gatsby.

Any Ideas?

Best, Marco

jacobarriola commented 4 years ago

I'm able to reproduce this as well (innerBlocks property showing on WP but not on Gatsby). It's not a blocking issue for me atm b/c I'm trying to use blocksJSON instead.

Example below is for CoreCoverBlock to demonstrate that it's not only related to the CoreColumnsBlock :)

image ☝️ WordPress GraphiQL

image ☝️ Gatsby GraphiQL

TylerBarnes commented 4 years ago

Thanks for opening this issue! This is something I've been working on fixing the last couple days. There are some issues here around the size of the query needed to source all the Gutenberg blocks into Gatsby. Peter Pristas (author of wp-graphql-gutenberg) and I have been discussing the best way to have it work well. I'll be adding a couple new API's so that Peter can create a Gatsby plugin that makes sourcing the blocks field more performant and reliable.

TylerBarnes commented 4 years ago

Essentially the problem is that during node sourcing I don't know how many levels deep I need to query for to get all the blocks. Since it's a very large query due to the number of available blocks, it gets even more difficult and becomes a very slow process. The plan is to add an api that will allow a plugin to prevent sourcing the blocks field but keep it in the schema, then the blocksJSON field will be parsed in the blocks resolver and used as the data for the normal query in Gatsby.

TylerBarnes commented 4 years ago

This is working properly now! I believe there are some data resolution bugs still (have them on my todolist), but sourcing and schema merging are working properly for wp-graphql-gutenberg now. Once we move from alpha to beta we'll be ensuring any more related bugs are squashed.