Giter VIP home page Giter VIP logo

wp-graphql-gutenberg's Introduction

wp-graphql-gutenberg's People

Contributors

bebjakub avatar bryndille1701 avatar colis avatar dependabot[bot] avatar jacobarriola avatar janfeldmann avatar jasonbahl avatar kingkero avatar kuuak avatar ojohnny avatar pristas-peter avatar rodrigo-arias avatar szepeviktor avatar tw-360vier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wp-graphql-gutenberg's Issues

Cannot return null for non-nullable field WpCoreGalleryBlockAttributes.images

There seems to be an issue with the attributes on the core gallery block when queried through Gatsby. A direct graphql query against the endpoint returns the image array as expected, the value is not null but gatsby seems to think it is when queried on there.

  allWpPage {
    nodes {
      blocks {
        ... on WpCoreGalleryBlock {
          name
          attributes {
            __typename
            ... on WpCoreGalleryBlockAttributes {
              align
              caption
              className
              columns
              ids
              imageCrop
              images {
                alt
                caption
                fullUrl
                id
                link
                url
              }
              linkTo
            }
          }
        }
      }
    }
  }
}

Activating changes the language of the block editor

Hello. Thanks for the great plugin!

By the way, activating the plugin changes some of the language in Gutenberg.
My WordPress is in Japanese, but it has English mixed in.

image

It's not a fatal problem, but is there a solution?


  • WordPress: v5.4.2
  • WP GraphQL: v0.9.1
  • WP GraphQL Gutenberg: v0.3.1
  • Mac: v10.15.5
  • Chrome: v83.0.4103.97

Content editor whitescreen: The editor has encountered an unexpected error.

Hey there!

For some reason, the content editor fails to load when this plugin is activated 🤔. This is for Pages and Posts.

image

What's the best way to troubleshoot this?

FYI - I am able to run queries on a page with blocks via GraphiQL on WordPress.
image

Using:
-wp-graphql: 0.9.1
-wp-gatsby: 0.4.1
-wp-graphql-gutenberg: 0.3.4
-Wordpress: 5.2.4

The dialogue that pops up allows me to copy the error. Here's the dump of that:

ue@*****/wp-content/plugins/wp-graphql-gutenberg-0.3.4/build/index.js?ver=fd9cc99659d1d150b19d0f988a85b971:24:8591
Td@*****/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.8.4:82:11
hi@*****/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.8.4:102:385
Qg@*****/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.8.4:144:219
Rg@*****/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.8.4:145:76
Sc@*****/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.8.4:158:109
Z@*****/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.8.4:156:494
Kc@*****/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.8.4:155:52
ya@*****/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.8.4:153:159
enqueueSetState@*****/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.8.4:202:411
t.prototype.setState@*****/wp-includes/js/dist/vendor/react.min.js?ver=16.8.4:20:433
value@*****/wp-includes/js/dist/data.min.js?ver=4.4.0:1:16219
value/this.unsubscribe<@*****/wp-includes/js/dist/data.min.js?ver=4.4.0:1:16397
n/<@*****/wp-includes/js/dist/data.min.js?ver=4.4.0:1:11659
n@*****/wp-includes/js/dist/data.min.js?ver=4.4.0:1:11632
m/y</<@*****/wp-includes/js/dist/data.min.js?ver=4.4.0:1:8807
v@*****/wp-includes/js/dist/data.min.js?ver=4.4.0:1:29557
b/</<@*****/wp-includes/js/dist/data.min.js?ver=4.4.0:1:5879
O/</</<@*****/wp-includes/js/dist/data.min.js?ver=4.4.0:1:6307
a/</</<@*****/wp-includes/js/dist/redux-routine.min.js?ver=3.2.0:1:9567
dispatch@*****/wp-includes/js/dist/data.min.js?ver=4.4.0:1:32017
i/<@*****/wp-includes/js/dist/redux-routine.min.js?ver=3.2.0:1:9218
e/<@*****/wp-includes/js/dist/redux-routine.min.js?ver=3.2.0:1:5434
e@*****/wp-includes/js/dist/redux-routine.min.js?ver=3.2.0:1:5410
o/<@*****/wp-includes/js/dist/redux-routine.min.js?ver=3.2.0:1:5364

HTML comments are all treated as Gutenberg blocks, causes errors for Next Page and Read More blocks

When importing https://github.com/Automattic/theme-tools/blob/master/gutenberg-test-data/gutenberg-test-data.xml

I get this error:

    {
      "debugMessage": "'properties' keyword must be an object, array given",
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "locations": [
        {
          "line": 6,
          "column": 7
        }
      ],
      "path": [
        "posts",
        "nodes",
        2,
        "blocksJSON"
      ]
    }

This appears to be related to the "Gutenberg: Layout Element Blocks" post that is imported.

Query breaks on posts with Page Breaks

When using this plugin on pages with a page-break block inserted, the query for said page will give an error. Given the error 'properties' keyword must be an object, array given I assume adding a page-break will split the page up in an array of objects instead of the object it would normally expect.

Steps to Reproduce

  1. Use wp-graphql and wp-graphql-gutenberg
  2. Create a post, add a page-break block
  3. Query the post with blocks included, i.e.:
query MyQuery {
  post(id: "postId") {
    id
    title
    blocks {
      dynamicContent
      originalContent
      saveContent
    }
  }
}

Error

{
  "errors": [
    {
      "debugMessage": "'properties' keyword must be an object, array given",
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "locations": [
        {
          "line": 5,
          "column": 4
        }
      ],
      "path": [
        "post",
        "blocks"
      ],
      "trace": [
        {
          "file": "/home/91934.cloudwaysapps.com/ngsmvdqahx/public_html/cfye-wp-headless/releases/20210406134406/web/app/plugins/wp-graphql-gutenberg/vendor/opis/json-schema/src/Validator.php",
          "line": 953,
          "call": "Opis\\JsonSchema\\Validator::validateObject()"
        },
...

Context (Environment)

WordPress 5.7
WPGraphQL 1.3.4
WP graphql Gutenberg 0.3.

Could not determine type of attribute "figureStyle" in "core/pullquote" block type

Hey,

I am experiencing some problems with the pullquote block. When WP_DEBUG is enabled I get the following warning:

Could not determine type of attribute "figureStyle" in "core/pullquote" block type
What is the point of this warning and how could I help to modify the function to handle blocks that do not have 'type' field.

Kind regards,
M

Plugin breaks with PHP 8

We've encountered various issues with this plugin when running PHP 8 that do not appear when running PHP 7.

A user of our Next.js starter repo pointed to the ivome/graphql-relay-php dependency as a potential culprit.

One issue we've been able to replicate on several devices:

  1. Add a paragraph block to a page with some text
  2. Change WP to PHP 8
  3. Query page: (this should work without error)
query MyQuery {
  page(id: "<ID>", idType: DATABASE_ID) {
    blocksJSON
  }
}
  1. Edit paragraph block to set a custom font-size
  2. Re-query page (it should throw an error this time) *
  3. Change WP to PHP 7
  4. Re-query page again (it should not throw an error now)

Error thrown when querying page:

{
  "errors": [
    {
      "debugMessage": "get_object_vars(): Argument #1 ($object) must be of type object, array given",
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "locations": [
        {
          "line": 3,
          "column": 5
        }
      ],
      "path": [
        "page",
        "blocksJSON"
      ],
      "trace": [
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql-gutenberg/vendor/opis/json-schema/src/Validator.php",
          "line": 1792,
          "function": "get_object_vars(array(1))"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql-gutenberg/vendor/opis/json-schema/src/Validator.php",
          "line": 953,
          "call": "Opis\\JsonSchema\\Validator::validateObject(instance of stdClass, array(1), array(1), array(0), instance of Opis\\JsonSchema\\Schema, instance of stdClass, instance of Opis\\JsonSchema\\ValidationResult, null)"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql-gutenberg/vendor/opis/json-schema/src/Validator.php",
          "line": 519,
          "call": "Opis\\JsonSchema\\Validator::validateProperties(instance of stdClass, array(1), array(1), array(0), instance of Opis\\JsonSchema\\Schema, instance of stdClass, instance of Opis\\JsonSchema\\ValidationResult, null)"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql-gutenberg/vendor/opis/json-schema/src/Validator.php",
          "line": 332,
          "call": "Opis\\JsonSchema\\Validator::validateKeywords(instance of stdClass, array(1), array(1), array(0), instance of Opis\\JsonSchema\\Schema, instance of stdClass, instance of Opis\\JsonSchema\\ValidationResult)"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql-gutenberg/vendor/opis/json-schema/src/Validator.php",
          "line": 1915,
          "call": "Opis\\JsonSchema\\Validator::validateSchema(instance of stdClass, array(1), array(1), array(0), instance of Opis\\JsonSchema\\Schema, instance of stdClass, instance of Opis\\JsonSchema\\ValidationResult)"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql-gutenberg/vendor/opis/json-schema/src/Validator.php",
          "line": 953,
          "call": "Opis\\JsonSchema\\Validator::validateObject(instance of stdClass, instance of stdClass, array(1), array(0), instance of Opis\\JsonSchema\\Schema, instance of stdClass, instance of Opis\\JsonSchema\\ValidationResult, array(2))"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql-gutenberg/vendor/opis/json-schema/src/Validator.php",
          "line": 519,
          "call": "Opis\\JsonSchema\\Validator::validateProperties(instance of stdClass, instance of stdClass, array(0), array(0), instance of Opis\\JsonSchema\\Schema, instance of stdClass, instance of Opis\\JsonSchema\\ValidationResult, array(2))"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql-gutenberg/vendor/opis/json-schema/src/Validator.php",
          "line": 332,
          "call": "Opis\\JsonSchema\\Validator::validateKeywords(instance of stdClass, instance of stdClass, array(0), array(0), instance of Opis\\JsonSchema\\Schema, instance of stdClass, instance of Opis\\JsonSchema\\ValidationResult)"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql-gutenberg/vendor/opis/json-schema/src/Validator.php",
          "line": 97,
          "call": "Opis\\JsonSchema\\Validator::validateSchema(instance of stdClass, instance of stdClass, array(0), array(0), instance of Opis\\JsonSchema\\Schema, instance of stdClass, instance of Opis\\JsonSchema\\ValidationResult)"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql-gutenberg/src/Blocks/Block.php",
          "line": 145,
          "call": "Opis\\JsonSchema\\Validator::schemaValidation(instance of stdClass, instance of Opis\\JsonSchema\\Schema)"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql-gutenberg/src/Blocks/Block.php",
          "line": 177,
          "call": "WPGraphQLGutenberg\\Blocks\\Block::parse_attributes(array(5), array(14))"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql-gutenberg/src/Blocks/Block.php",
          "line": 25,
          "call": "WPGraphQLGutenberg\\Blocks\\Block::__construct(array(5), 15, array(36), 0, null)"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql-gutenberg/src/Schema/Types/InterfaceType/BlockEditorContentNode.php",
          "line": 36,
          "call": "WPGraphQLGutenberg\\Blocks\\Block::create_blocks(array(1), 15, array(36))"
        },
        {
          "call": "WPGraphQLGutenberg\\Schema\\Types\\InterfaceType\\BlockEditorContentNode::WPGraphQLGutenberg\\Schema\\Types\\InterfaceType\\{closure}(instance of WPGraphQL\\Model\\Post, array(0), instance of WPGraphQL\\AppContext, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql/src/Utils/InstrumentSchema.php",
          "line": 177,
          "function": "call_user_func(instance of Closure, instance of WPGraphQL\\Model\\Post, array(0), instance of WPGraphQL\\AppContext, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
        },
        {
          "call": "WPGraphQL\\Utils\\InstrumentSchema::WPGraphQL\\Utils\\{closure}(instance of WPGraphQL\\Model\\Post, array(0), instance of WPGraphQL\\AppContext, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql/src/Utils/InstrumentSchema.php",
          "line": 177,
          "function": "call_user_func(instance of Closure, instance of WPGraphQL\\Model\\Post, array(0), instance of WPGraphQL\\AppContext, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 624,
          "call": "WPGraphQL\\Utils\\InstrumentSchema::WPGraphQL\\Utils\\{closure}(instance of WPGraphQL\\Model\\Post, array(0), instance of WPGraphQL\\AppContext, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 550,
          "call": "GraphQL\\Executor\\ReferenceExecutor::resolveFieldValueOrError(instance of GraphQL\\Type\\Definition\\FieldDefinition, instance of GraphQL\\Language\\AST\\FieldNode, instance of Closure, instance of WPGraphQL\\Model\\Post, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 1196,
          "call": "GraphQL\\Executor\\ReferenceExecutor::resolveField(GraphQLType: Page, instance of WPGraphQL\\Model\\Post, instance of ArrayObject(1), array(2))"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 1146,
          "call": "GraphQL\\Executor\\ReferenceExecutor::executeFields(GraphQLType: Page, instance of WPGraphQL\\Model\\Post, array(1), instance of ArrayObject(1))"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 1107,
          "call": "GraphQL\\Executor\\ReferenceExecutor::collectAndExecuteSubfields(GraphQLType: Page, instance of ArrayObject(1), array(1), instance of WPGraphQL\\Model\\Post)"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 794,
          "call": "GraphQL\\Executor\\ReferenceExecutor::completeObjectValue(GraphQLType: Page, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(1), instance of WPGraphQL\\Model\\Post)"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 652,
          "call": "GraphQL\\Executor\\ReferenceExecutor::completeValue(GraphQLType: Page, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(1), instance of WPGraphQL\\Model\\Post)"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/Promise/Adapter/SyncPromise.php",
          "line": 148,
          "call": "GraphQL\\Executor\\ReferenceExecutor::GraphQL\\Executor\\{closure}(instance of WPGraphQL\\Model\\Post)"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/Promise/Adapter/SyncPromise.php",
          "line": 53,
          "call": "GraphQL\\Executor\\Promise\\Adapter\\SyncPromise::GraphQL\\Executor\\Promise\\Adapter\\{closure}()"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/Promise/Adapter/SyncPromiseAdapter.php",
          "line": 149,
          "call": "GraphQL\\Executor\\Promise\\Adapter\\SyncPromise::runQueue()"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Server/Helper.php",
          "line": 214,
          "call": "GraphQL\\Executor\\Promise\\Adapter\\SyncPromiseAdapter::wait(instance of GraphQL\\Executor\\Promise\\Promise)"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Server/StandardServer.php",
          "line": 136,
          "call": "GraphQL\\Server\\Helper::executeOperation(instance of GraphQL\\Server\\ServerConfig, instance of GraphQL\\Server\\OperationParams)"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql/src/Request.php",
          "line": 602,
          "call": "GraphQL\\Server\\StandardServer::executeRequest(instance of GraphQL\\Server\\OperationParams)"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql/src/Router.php",
          "line": 465,
          "call": "WPGraphQL\\Request::execute_http()"
        },
        {
          "file": ".../app/public/wp-content/plugins/wp-graphql/src/Router.php",
          "line": 270,
          "call": "WPGraphQL\\Router::process_http_request()"
        },
        {
          "file": ".../app/public/wp-includes/class-wp-hook.php",
          "line": 292,
          "call": "WPGraphQL\\Router::resolve_http_request(instance of WP)"
        },
        {
          "file": ".../app/public/wp-includes/class-wp-hook.php",
          "line": 316,
          "call": "WP_Hook::apply_filters(null, array(1))"
        },
        {
          "file": ".../app/public/wp-includes/plugin.php",
          "line": 551,
          "call": "WP_Hook::do_action(array(1))"
        },
        {
          "file": ".../app/public/wp-includes/class-wp.php",
          "line": 388,
          "function": "do_action_ref_array('parse_request', array(1))"
        },
        {
          "file": ".../app/public/wp-includes/class-wp.php",
          "line": 750,
          "call": "WP::parse_request((empty string))"
        },
        {
          "file": ".../app/public/wp-includes/functions.php",
          "line": 1291,
          "call": "WP::main((empty string))"
        },
        {
          "file": ".../app/public/wp-blog-header.php",
          "line": 16,
          "function": "wp()"
        },
        {
          "file": ".../app/public/index.php",
          "line": 17,
          "function": "require('.../app/public/wp-blog-header.php')"
        }
      ]
    }
  ],
  "data": {
    "page": {
      "blocksJSON": null
    }
  },
  "extensions": {
    "debug": []
  }
}

Gutenburg GraphQl error while running gatsby build

Hi,

I am facing an issue while running the gatsby build. Every time I run the build it throws an error - GraphQL request to http://......../cms/index.php?graphql failed. To avoid this we update block registry in wp-graphql-Gutenberg-admin.
But then also it keeps on failing.

Any idea how to resolve this?

Note: ...... represents our company's internal domain name

tempsnip

Internal Server Error (500) w/ "'properties' keyword must be an object, NULL given" message

This error ocrrurs with only one of my current posts:

GraphiQL query:

query MyQuery {
  post(id: "a-importancia-do-versionamento-de-arquivos", idType: SLUG) {
    title
    blocks {
      __typename
    }
  }
}

GraphiQL response:

{
  "errors": [
    {
      "debugMessage": "'properties' keyword must be an object, NULL given",
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "locations": [
        {
          "line": 4,
          "column": 5
        }
      ],
      "path": [
        "post",
        "blocks"
      ],
      "trace": [
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql-gutenberg-0.3.8/vendor/opis/json-schema/src/Validator.php",
          "line": 953,
          "call": "Opis\\JsonSchema\\Validator::validateObject(instance of stdClass, instance of stdClass, array(0), array(0), instance of Opis\\JsonSchema\\Schema, instance of stdClass, instance of Opis\\JsonSchema\\ValidationResult, null)"
        },
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql-gutenberg-0.3.8/vendor/opis/json-schema/src/Validator.php",
          "line": 519,
          "call": "Opis\\JsonSchema\\Validator::validateProperties(instance of stdClass, instance of stdClass, array(0), array(0), instance of Opis\\JsonSchema\\Schema, instance of stdClass, instance of Opis\\JsonSchema\\ValidationResult, null)"
        },
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql-gutenberg-0.3.8/vendor/opis/json-schema/src/Validator.php",
          "line": 332,
          "call": "Opis\\JsonSchema\\Validator::validateKeywords(instance of stdClass, instance of stdClass, array(0), array(0), instance of Opis\\JsonSchema\\Schema, instance of stdClass, instance of Opis\\JsonSchema\\ValidationResult)"
        },
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql-gutenberg-0.3.8/vendor/opis/json-schema/src/Validator.php",
          "line": 97,
          "call": "Opis\\JsonSchema\\Validator::validateSchema(instance of stdClass, instance of stdClass, array(0), array(0), instance of Opis\\JsonSchema\\Schema, instance of stdClass, instance of Opis\\JsonSchema\\ValidationResult)"
        },
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql-gutenberg-0.3.8/src/Blocks/Block.php",
          "line": 145,
          "call": "Opis\\JsonSchema\\Validator::schemaValidation(instance of stdClass, instance of Opis\\JsonSchema\\Schema)"
        },
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql-gutenberg-0.3.8/src/Blocks/Block.php",
          "line": 177,
          "call": "WPGraphQLGutenberg\\Blocks\\Block::parse_attributes(array(5), null)"
        },
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql-gutenberg-0.3.8/src/Blocks/Block.php",
          "line": 25,
          "call": "WPGraphQLGutenberg\\Blocks\\Block::__construct(array(5), 10, array(43), 11, null)"
        },
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql-gutenberg-0.3.8/src/Schema/Types/InterfaceType/BlockEditorContentNode.php",
          "line": 25,
          "call": "WPGraphQLGutenberg\\Blocks\\Block::create_blocks(array(23), 10, array(43))"
        },
        {
          "call": "WPGraphQLGutenberg\\Schema\\Types\\InterfaceType\\BlockEditorContentNode::WPGraphQLGutenberg\\Schema\\Types\\InterfaceType\\{closure}(instance of WPGraphQL\\Model\\Post, array(0), instance of WPGraphQL\\AppContext, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
        },
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql/src/Utils/InstrumentSchema.php",
          "line": 177,
          "function": "call_user_func(instance of Closure, instance of WPGraphQL\\Model\\Post, array(0), instance of WPGraphQL\\AppContext, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
        },
        {
          "call": "WPGraphQL\\Utils\\InstrumentSchema::WPGraphQL\\Utils\\{closure}(instance of WPGraphQL\\Model\\Post, array(0), instance of WPGraphQL\\AppContext, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
        },
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql/src/Utils/InstrumentSchema.php",
          "line": 177,
          "function": "call_user_func(instance of Closure, instance of WPGraphQL\\Model\\Post, array(0), instance of WPGraphQL\\AppContext, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
        },
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 624,
          "call": "WPGraphQL\\Utils\\InstrumentSchema::WPGraphQL\\Utils\\{closure}(instance of WPGraphQL\\Model\\Post, array(0), instance of WPGraphQL\\AppContext, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
        },
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 550,
          "call": "GraphQL\\Executor\\ReferenceExecutor::resolveFieldValueOrError(instance of GraphQL\\Type\\Definition\\FieldDefinition, instance of GraphQL\\Language\\AST\\FieldNode, instance of Closure, instance of WPGraphQL\\Model\\Post, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
        },
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 1196,
          "call": "GraphQL\\Executor\\ReferenceExecutor::resolveField(GraphQLType: Post, instance of WPGraphQL\\Model\\Post, instance of ArrayObject(1), array(2))"
        },
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 1146,
          "call": "GraphQL\\Executor\\ReferenceExecutor::executeFields(GraphQLType: Post, instance of WPGraphQL\\Model\\Post, array(1), instance of ArrayObject(2))"
        },
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 1107,
          "call": "GraphQL\\Executor\\ReferenceExecutor::collectAndExecuteSubfields(GraphQLType: Post, instance of ArrayObject(1), array(1), instance of WPGraphQL\\Model\\Post)"
        },
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 794,
          "call": "GraphQL\\Executor\\ReferenceExecutor::completeObjectValue(GraphQLType: Post, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(1), instance of WPGraphQL\\Model\\Post)"
        },
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
          "line": 652,
          "call": "GraphQL\\Executor\\ReferenceExecutor::completeValue(GraphQLType: Post, instance of ArrayObject(1), instance of GraphQL\\Type\\Definition\\ResolveInfo, array(1), instance of WPGraphQL\\Model\\Post)"
        },
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/Promise/Adapter/SyncPromise.php",
          "line": 148,
          "call": "GraphQL\\Executor\\ReferenceExecutor::GraphQL\\Executor\\{closure}(instance of WPGraphQL\\Model\\Post)"
        },
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/Promise/Adapter/SyncPromise.php",
          "line": 53,
          "call": "GraphQL\\Executor\\Promise\\Adapter\\SyncPromise::GraphQL\\Executor\\Promise\\Adapter\\{closure}()"
        },
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Executor/Promise/Adapter/SyncPromiseAdapter.php",
          "line": 149,
          "call": "GraphQL\\Executor\\Promise\\Adapter\\SyncPromise::runQueue()"
        },
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Server/Helper.php",
          "line": 214,
          "call": "GraphQL\\Executor\\Promise\\Adapter\\SyncPromiseAdapter::wait(instance of GraphQL\\Executor\\Promise\\Promise)"
        },
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql/vendor/webonyx/graphql-php/src/Server/StandardServer.php",
          "line": 136,
          "call": "GraphQL\\Server\\Helper::executeOperation(instance of GraphQL\\Server\\ServerConfig, instance of GraphQL\\Server\\OperationParams)"
        },
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql/src/Request.php",
          "line": 602,
          "call": "GraphQL\\Server\\StandardServer::executeRequest(instance of GraphQL\\Server\\OperationParams)"
        },
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql/src/Router.php",
          "line": 465,
          "call": "WPGraphQL\\Request::execute_http()"
        },
        {
          "file": "/var/www/html/wp-content/plugins/wp-graphql/src/Router.php",
          "line": 270,
          "call": "WPGraphQL\\Router::process_http_request()"
        },
        {
          "file": "/var/www/html/wp-includes/class-wp-hook.php",
          "line": 292,
          "call": "WPGraphQL\\Router::resolve_http_request(instance of WP)"
        },
        {
          "file": "/var/www/html/wp-includes/class-wp-hook.php",
          "line": 316,
          "call": "WP_Hook::apply_filters(null, array(1))"
        },
        {
          "file": "/var/www/html/wp-includes/plugin.php",
          "line": 551,
          "call": "WP_Hook::do_action(array(1))"
        },
        {
          "file": "/var/www/html/wp-includes/class-wp.php",
          "line": 388,
          "function": "do_action_ref_array('parse_request', array(1))"
        },
        {
          "file": "/var/www/html/wp-includes/class-wp.php",
          "line": 750,
          "call": "WP::parse_request((empty string))"
        },
        {
          "file": "/var/www/html/wp-includes/functions.php",
          "line": 1291,
          "call": "WP::main((empty string))"
        },
        {
          "file": "/var/www/html/wp-blog-header.php",
          "line": 16,
          "function": "wp()"
        },
        {
          "file": "/var/www/html/index.php",
          "line": 17,
          "function": "require('/var/www/html/wp-blog-header.php')"
        }
      ]
    }
  ],
  "data": {
    "post": {
      "title": "A importância do versionamento de arquivos",
      "blocks": null
    }
  },
  "extensions": {
    "debug": []
  }
}

Wordpress: 5.7
WP GraphQL: 1.3.4
WP GraphQL Gutenberg: 0.3.8

image

Fatal Error with WP GraphQL 0.9.0

After installing the following:

  1. [email protected]
  2. [email protected]

I get a 500 error when accessing the /graphql endpoint:

Uncaught ArgumentCountError: Too few arguments to function register_graphql_scalar(), 1 passed in /var/www/html/wp-content/plugins/wp-graphql-gutenberg-0.2.1/src/Schema/Types/Scalar/Scalar.php on line 31 and exactly 2 expected in /var/www/html/wp-content/plugins/wp-graphql-0.9.0/access-functions.php:254

Stack trace:

#0 /var/www/html/wp-content/plugins/wp-graphql-gutenberg-0.2.1/src/Schema/Types/Scalar/Scalar.php(31): register_graphql_scalar(Array)

#1 /var/www/html/wp-content/plugins/wp-graphql-gutenberg-0.2.1/src/Schema/Types/BlockTypes.php(69): WPGraphQLGutenberg\Schema\Types\Scalar\Scalar::BlockAttributesArray()

#2 /var/www/html/wp-content/plugins/wp-graphql-gutenberg-0.2.1/src/Schema/Types/BlockTypes.php(97): WPGraphQLGutenberg\Schema\Types\BlockTypes::get_attribute_type('description', Array, 'YoastHowToBlock...')

#3 /var/www/html/wp-content/plugins/wp-graphql-gutenberg-0.2.1/src/Schema/Types/BlockTypes.php(143): WPGraphQLGutenberg\Schema\Types\BlockTypes::create_attributes_fields(Array, 'YoastHowToBlock.. in /var/www/html/wp-content/plugins/wp-graphql-0.9.0/access-functions.php on line 254

Adds generic way to get block attributes

According to the doc, you always needs to need the type of a block in order to get the attributes of this block. This could lead to a ton of codes in order to get all attributes.

# ...
# blocks field represents array of Block
blocks {
    # fields from the interface
    clientId
    isDynamic
    ... on CoreParagraphBlock {
        attributes {
            ... on CoreParagraphBlockAttributes {
                content
            }
        }
    }
}
# ...

The project Quartz/wp-graphql-content-blocks has another approach:

attributes {
	name
	value
}
"attributes": [
	{
		"name": "src",
		"value": "https://example.com/fresh-prince.jpeg"
	},
	{
		"name": "alt",
		"value": "The Fresh Prince of Bel Air"
	}
]

Is it something that could be implemented in this plugin?

Namespace containing reserved keyword

Hi!

I noticed today that wp-graphql-gutenberg uses the following namespace in one place:

WPGraphQLGutenberg\Schema\Types\Object

The object keyword is reserved in PHP 7.2 and later, and cannot be used in namespaces.

While this seems not to affect execution in most situations, it can, for example with this code:

use WPGraphQLGutenberg\Schema\Types\Object;

as PHP will give a fatal error with this usage:

Fatal error: Cannot use WPGraphQLGutenberg\Schema\Types\Object as Object because 'Object' is a special class name in Standard input code on line 6

I tested this with PHP 7.4 and PHP 8.0. When Object is renamed to Object2, it works as expected.

I wanted to flag this, as this could potentially become problematic in other contexts in the future. A suggested solution is to rename the namespace.

Your wordpress server appears to be overloaded.

Hi guys!

I'm using Gatsby with Wordpress and GraphQL + gutenberg to query data. But I'm getting this error when building the development server (gatsby develop).

 ERROR #gatsby-source-wordpress-experimental_111007 

 gatsby-source-wordpress  Your wordpress server at http://localwp/graphql appears to be overloaded.

Try reducing the requestConcurrency for content updates or the previewRequestConcurrency for previews:

{
  resolve: 'gatsby-source-wordpress-experimental',
  options: {
    schema: {
      requestConcurrency: 5, // currently set to 5
      previewRequestConcurrency: 2, // currently set to 2
    }
  },
}

The GATSBY_CONCURRENT_REQUEST environment variable is no longer used to control concurrency.
If you were previously using that, you'll need to use the settings above instead.

I disabled WP GraphQL Gutenberg (v0.3.5) and it started to work again. This plugin might be overloading the wordpress server. It's probably some incompatibility between WP GraphQL (v1.1.0) and WP GraphQL Gutenberg (v0.3.5).

Appreciate any help!

PHP Fatal error: Uncaught Error: Cannot use object of type GraphQL\\Type\\SchemaConfig as array

Wordpress instance just auto-updated WPGraphQL plugin, and now getting a 500 error when trying to load the schema in the wp-admin GraphiQL viewer.

PHP Fatal error: Uncaught Error: Cannot use object of type GraphQL\Type\SchemaConfig as array in wp-content/plugins/wp-graphql-gutenberg-0.3.6/src/Schema/Types/BlockTypes.php:272
Stack trace:
#0 wp-includes/class-wp-hook.php(287): WPGraphQLGutenberg\Schema\Types\BlockTypes->WPGraphQLGutenberg\Schema\Types\{closure}(Object(GraphQL\Type\SchemaConfig))
1 wp-includes/plugin.php(212): WP_Hook->apply_filters(Object(GraphQL\Type\SchemaConfig), Array)
2 wp-content/plugins/wp-graphql/src/WPSchema.php(50): apply_filters('graphql_schema_...', Object(GraphQL\Type\SchemaConfig))
3 wp-content/plugins/wp-graphql/src/Registry/SchemaRegistry.php(50): WPGraphQL\WPSchema->__construct(Object(GraphQL\Type\SchemaConfig))
4 wp-content/plugins/wp-graphql/wp-graphql.php(602): WPGraphQL\Registry\SchemaRegistry->get_schema()
5 wp-content/plugins/wp-graphql/src/Request.
in wp-content/plugins/wp-graphql-gutenberg-0.3.6/src/Schema/Types/BlockTypes.php on line 272, referer: https://domain.com/wp-admin/admin.php?page=graphiql-ide

Version of wpgraphql plugin before, that was working, was 1.0.5, version now is 1.1.1.

attributes.content returns not rendered or it returns with its html tag

query MyQuery {
postBy(id: ""cG9zdDoyMjE="") {
blocks {
... on CoreHeadingBlock {
attributes {
content
}
}
}
}
}

return

"data": {
"postBy": {
"blocks": [
{},
{},
{},
{},
{},
{},
{},
{},
{},
{
"attributes": {
"content": "\nIngat kembali mimpi Anda !"
}
},
{},
{},
{},
{},
{},
{},
{},
{},
{
"attributes": {
"content": "\nKeluar dari rutinitas Anda (ganti sedikit juga\ntidak apa-apa)"

and in
Screenshot from 2020-03-16 16-50-35

core/freeform not available in blocks and previewBlocks

Since Wordpress returns blockName=>null on core/freeform when using parse_blocks the block wont appear in the blocks and previewBlocks field.

/src/Blocks/Block.php on line 16 jumps over blocks with name that are empty.

How do you suggest the best way is to expose that block?

PHP Min Version

Hey all,

I love this plugin so I'm not trying to be a complainer because I really appreciate the work you've done. I just wanted to note that the use of dangle commas in PHP are specific to php 7.3.

I was running 7.2 and had an error when I tried to activate the plugin due to the dangle comma on line 462. I knew what it was right away and upgraded my dev environment to 7.3 but I think a notice could help newer developers, or Javascript developers that aren't familiar with PHP, get started with this repo.

I'm only posting because I think that this is a much better pattern for reusability imho for Gutenberg blocks and I'd like to see more people using it!

Cheers,
Freddie

PS: I'll make a PR for a notice if you'd like :)

'Error: Type with name "WpBlockAttributesObject" does not exists'

When I activate the wp-graphql-gutenberg plugin I get this error when running npm start. I'm using the following plugin versions:

gatsby-source-wordpress-experimental: 6.0.0
wp-graphql-gutenberg: 0.3.5
WPGraphQL: 1.0.3
WPGatsby: 0.9.1

To reproduce, simply activate the plugin on a fresh WP install, setup a gatsby site with the new gatsby-source-wordpress-experimental plugin and run npm start.

Missing onError handler for invocation 'building-schema', error was 'Error: Type with name "WpBlockAttributesObject" does not exists'
Missing onError handler for invocation 'building-schema', error was 'Error: Type with name "WpBlockAttributesObject"
does not exists'. Stacktrace was 'Error: Type with name "WpBlockAttributesObject" does not exists
    at SchemaComposer.get
(/home/luke/dev/lukemiller93/wp-gutenberg-test/node_modules/graphql-compose/lib/TypeStorage.js:44:13)
    at TypeMapper.get
(/home/luke/dev/lukemiller93/wp-gutenberg-test/node_modules/graphql-compose/lib/TypeMapper.js:86:44)
    at TypeMapper.typeFromAST
(/home/luke/dev/lukemiller93/wp-gutenberg-test/node_modules/graphql-compose/lib/TypeMapper.js:608:17)
    at TypeMapper.typeFromAST
(/home/luke/dev/lukemiller93/wp-gutenberg-test/node_modules/graphql-compose/lib/TypeMapper.js:598:24)
    at TypeMapper.typeFromAST
(/home/luke/dev/lukemiller93/wp-gutenberg-test/node_modules/graphql-compose/lib/TypeMapper.js:603:24)
    at TypeMapper.getWrapped
(/home/luke/dev/lukemiller93/wp-gutenberg-test/node_modules/graphql-compose/lib/TypeMapper.js:105:17)
    at TypeMapper.convertOutputFieldConfig
(/home/luke/dev/lukemiller93/wp-gutenberg-test/node_modules/graphql-compose/lib/TypeMapper.js:272:114)
    at resolveOutputConfigAsThunk
(/home/luke/dev/lukemiller93/wp-gutenberg-test/node_modules/graphql-compose/lib/utils/configAsThunk.js:19:41)
    at /home/luke/dev/lukemiller93/wp-gutenberg-test/node_modules/graphql-compose/lib/utils/configAsThunk.js:37:22
    at Array.forEach (<anonymous>)
    at resolveOutputConfigMapAsThunk
(/home/luke/dev/lukemiller93/wp-gutenberg-test/node_modules/graphql-compose/lib/utils/configAsThunk.js:36:27)
    at GraphQLObjectType.gqType._fields
(/home/luke/dev/lukemiller93/wp-gutenberg-test/node_modules/graphql-compose/lib/ObjectTypeComposer.js:147:114)
    at GraphQLObjectType.getFields
(/home/luke/dev/lukemiller93/wp-gutenberg-test/node_modules/graphql/type/definition.js:579:27)
    at typeMapReducer (/home/luke/dev/lukemiller93/wp-gutenberg-test/node_modules/graphql/type/schema.js:280:78)
    at Array.reduce (<anonymous>)
    at new GraphQLSchema (/home/luke/dev/lukemiller93/wp-gutenberg-test/node_modules/graphql/type/schema.js:145:28)'

Any help would be appreciated!

[Question] Not working with custom post types

I've created a CPT named News, I've set support to editor, show_in_graphql, show_in_rest.
All working with graphql. But when query blocks I get Cannot query field \"blocks\" on type \"News\".

Is there any setting I may have forgotten?

Error with Gatsby V3

Hello, thank you for this great plugin.

Unfortunately I can't make it work with Gatsby V3. The build phase just stops with this error:

Interfaces with the nodeInterfaceextension must have a fieldidof typeID!. Check the type definition of WpBlockEditorContentNode.

Deactivating Wp GraphQL Gutenberg Wordpress plugin the error disappears, but obviously I can't get the gutenberg blocks fields using GraphQL. Note that from the Wordpress graphiql client everythings works correctly, but Gatsby, using Wordpress source v5 (the Gatsby v3 updated version) just seems not to compile.

Is there any way to fix this issue? Thank you!

Attributes for paragraph block nested inside a column block not working

The attributes for a paragraph block nested inside a column block are not working.

__typename on the attribute field causes an Internal server error.

Expected Behavior

Nested paragraph attributes are available - my test shows nested headings and images are working OK.

Steps to Reproduce

Create a columns layout block in the editor. Add a heading and paragraph on left, and image block on right.

Running the following query I get the following response.

Query

query pages {
  pageBy( uri: "home") {
    id
    blocks {
      ... on CoreColumnsBlock {
        innerBlocks {
          ... on CoreColumnBlock {
            innerBlocks {
              ... on CoreHeadingBlock {
                attributes {
                  ... on CoreHeadingBlockAttributes {
                    content
                  }
                }
              }
              ... on CoreParagraphBlock {
                originalContent
                isValid
                attributes {
                  __typename
                  ... on CoreParagraphBlockAttributesV3 {
                    content
                  }
                }
              }
              ... on CoreImageBlock {
                attributes {
                  ... on CoreImageBlockAttributes {
                    url
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

Response

{
  "errors": [
    {
      "message": "Internal server error",
      "category": "internal",
      "locations": [
        {
          "line": 19,
          "column": 17
        }
      ],
      "path": [
        "pageBy",
        "blocks",
        1,
        "innerBlocks",
        0,
        "innerBlocks",
        1,
        "attributes"
      ]
    }
  ],
  "data": {
    "pageBy": {
      "id": "cGFnZTo2MA==",
      "blocks": [
        {},
        {
          "innerBlocks": [
            {
              "innerBlocks": [
                {
                  "attributes": {
                    "content": "Our story"
                  }
                },
                {
                  "originalContent": "<p>Hi there</p>",
                  "isValid": true,
                  "attributes": null
                }
              ]
            },
            {
              "innerBlocks": [
                {
                  "attributes": {
                    "url": "http://localhost/wp/wp-content/uploads/2019/04/bay-1787065_1920-1024x683.jpg"
                  }
                }
              ]
            }
          ]
        },
        {},
        {},
        {},
        {}
      ]
    }
  }
}

Schema error

Hello,
I have what I believe to be a schema related problem. I get the following error message when going to http://localhost/graphql in my browser (project path replaced with *****):

Fatal error: Uncaught Error: Cannot use object of type GraphQL\Type\SchemaConfig as array in *****/wp-content/plugins/wp-graphql-gutenberg/src/Schema/Types/BlockTypes.php:248 Stack trace: #0 *****/wp-includes/class-wp-hook.php(287): WPGraphQLGutenberg\Schema\Types\BlockTypes->WPGraphQLGutenberg\Schema\Types\{closure}(Object(GraphQL\Type\SchemaConfig)) #1 *****/wp-includes/plugin.php(212): WP_Hook->apply_filters(Object(GraphQL\Type\SchemaConfig), Array) #2 *****/wp-content/plugins/wp-graphql/src/WPSchema.php(50): apply_filters('graphql_schema_...', Object(GraphQL\Type\SchemaConfig)) #3 *****/wp-content/plugins/wp-graphql/src/Registry/SchemaRegistry.php(50): WPGraphQL\WPSchema->__construct(Object(GraphQL\Type\SchemaConfig)) #4 *****/wp-content/plugins/wp-graphql/src/WPGraphQL. in *****/wp-content/plugins/wp-graphql-gutenberg/src/Schema/Types/BlockTypes.php on line 248

Trying to access the graphql endpoint via GraphiQL returns this standard WordPress error message (in Norwegian in this case):

{ "code": "internal_server_error", "message": "<p>En kritisk feil har inntruffet på dette nettstedet.</p><p><a href=\"https://wordpress.org/support/article/debugging-in-wordpress/\">Lær mer om feilsøking i WordPress.</a></p>", "data": { "status": 500 }, "additional_errors": [] }

My wpgrapql stack
wp-graphql
wp-graphql-acf
wp-graphql-gutenberg
wp-graphql-gutenberg-acf
wp-graphql-polylang
add-wpgraphql-seo

What I think triggered the error
I hit the "Update block registry" button in wp-admin. This has killed the website several times before too, but i has usually "fixed itself" somehow after a while.

What I have tried
I have tried deactivating and reactivating various wpgraphql plugins. Disabling wp-graphql-gutenberg removes the 500 error, but then I can't access block data obviously. Only disabling wp-graphql-gutenberg-acf makes no difference.

Type conflict when pulling entire schema

Hey Peter!
Hope the new plugin is going well :)
I'm testing out this one with the upcoming gatsby-source-wordpress@v4. The new version uses introspection to generate full-schema queries in order to pull the entire WPGQL schema, and while doing so I'm running into some type conflicts.

When I run this query

query NODE_LIST_QUERY {
  pages {
    nodes {
      blocks {
        __typename
        ... on CoreParagraphBlock {
          attributes {
            __typename
            ... on CoreParagraphBlockAttributesV2 {
              fontSize
            }
            ... on CoreParagraphBlockAttributesV3 {
              content
              fontSize
            }
          }
        }
        ... on CoreCodeBlock {
          attributes {
            content
          }
        }
      }
    }
  }
}

I get these errors:

{
  "errors": [
    {
      "message": "Fields \"attributes\" conflict because subfields \"content\" conflict because they return conflicting types String! and String. Use different aliases on the fields to fetch both if this was intentional.",
      "category": "graphql",
      "locations": [
        {
          "line": 7,
          "column": 11
        },
        {
          "line": 13,
          "column": 15
        },
        {
          "line": 19,
          "column": 11
        },
        {
          "line": 20,
          "column": 13
        }
      ]
    },
    {
      "message": "Fields \"fontSize\" conflict because they return conflicting types Float and String. Use different aliases on the fields to fetch both if this was intentional.",
      "category": "graphql",
      "locations": [
        {
          "line": 10,
          "column": 15
        },
        {
          "line": 14,
          "column": 15
        }
      ]
    }
  ]
}

I think it's because different block types that are implementing the Block interface are defining fields with the same name but the fields have different types. Any thoughts on a quick fix? @jasonbahl curious if you have any ideas as well

Getting "Could not determine type of attribute" warning on GraphQL endpoint

On a fresh site, I get the following warning on the /graphql endpoint:

Warning: Could not determine type of attribute "figureStyle" in "core/pullquote" block type. in /var/www/html/public/wp-content/plugins/wp-graphql-gutenberg/plugin.php on line 424

Queries to the endpoint still go through, but it seems like this should be resolved in case anyone wants to query for the figureStyle attribute of a Pull Quote block.

Steps to replicate issue:

  1. Spin up fresh WP site (using WP v5.3.2 for this test)
  2. Install and enable both WP GraphQL v0.6.1 and WP GraphQL Gutenberg v0.1.4
  3. Go to WP GraphQL Gutenberg Admin page (/wp/wp-admin/admin.php?page=wp-graphql-gutenberg-admin) and click "update" button
  4. Go to the GraphQL endpoint (in my case /wp/graphql). I'd expect to see the usual JSON payload with the "GraphQL Request must include" message, but you also get the figureStyle pull quote attribute warning.

Full result:

$ curl http://localhost:8080/wp/graphql

Warning: Could not determine type of attribute "figureStyle" in "core/pullquote" block type. in /var/www/html/public/wp-content/plugins/wp-graphql-gutenberg/plugin.php on line 424
{"errors":[{"message":"GraphQL Request must include at least one of those two parameters: \"query\" or \"queryId\"","category":"request"}]}

Default branch

Please set develop as the default branch here on GitHub as contributions should go into it, not into master.

Undefined index: type in generate_graphql_attributes_fields

WP 5.3
WP GraphQL: 0.4.0
WP GraphQL Gutenberg: 0.1.1
(Gutenberg: 7.0.0 - the notice is thrown whether activated or not)

Currently, my debug log is spammed with the following two messages:


Notice: Undefined index: type in /var/www/web/app/plugins/wp-graphql-gutenberg/plugin.php on line 277
  |  
  | Call Stack:
  | 0.0001     414240   1. {main}() /var/www/web/wp/index.php:0
  | 0.0001     414520   2. require('/var/www/web/wp/wp-blog-header.php') /var/www/web/wp/index.php:17
  | 0.1386    7786216   3. wp() /var/www/web/wp/wp-blog-header.php:16
  | 0.1386    7786264   4. WP->main() /var/www/web/wp/wp-includes/functions.php:1250
  | 0.1386    7786264   5. WP->parse_request() /var/www/web/wp/wp-includes/class-wp.php:729
  | 0.1394    7812888   6. do_action_ref_array() /var/www/web/wp/wp-includes/class-wp.php:387
  | 0.1394    7812888   7. WP_Hook->do_action() /var/www/web/wp/wp-includes/plugin.php:544
  | 0.1394    7812888   8. WP_Hook->apply_filters() /var/www/web/wp/wp-includes/class-wp-hook.php:312
  | 0.1394    7814016   9. WPGraphQL\Router->resolve_http_request() /var/www/web/wp/wp-includes/class-wp-hook.php:288
  | 0.1394    7814040  10. WPGraphQL\Router::process_http_request() /var/www/web/app/plugins/wp-graphql/src/Router.php:155
  | 0.1394    7880792  11. WPGraphQL\Request->__construct() /var/www/web/app/plugins/wp-graphql/src/Router.php:341
  | 0.1397    7895040  12. WPGraphQL::get_schema() /var/www/web/app/plugins/wp-graphql/src/Request.php:107
  | 0.1397    7897424  13. WPGraphQL\Registry\SchemaRegistry->get_schema() /var/www/web/app/plugins/wp-graphql/wp-graphql.php:527
  | 0.1397    7897424  14. WPGraphQL\Registry\TypeRegistry->init() /var/www/web/app/plugins/wp-graphql/src/Registry/SchemaRegistry.php:37
  | 0.1398    7921120  15. do_action() /var/www/web/app/plugins/wp-graphql/src/Registry/TypeRegistry.php:334
  | 0.1398    7921496  16. WP_Hook->do_action() /var/www/web/wp/wp-includes/plugin.php:478
  | 0.1398    7921496  17. WP_Hook->apply_filters() /var/www/web/wp/wp-includes/class-wp-hook.php:312
  | 0.1398    7922624  18. WPGraphQL\Registry\TypeRegistry->WPGraphQL\Registry\{closure:/var/www/web/app/plugins/wp-graphql/src/Registry/TypeRegistry.php:146-318}() /var/www/web/wp/wp-includes/class-wp-hook.php:288
  | 0.1693    9962096  19. do_action() /var/www/web/app/plugins/wp-graphql/src/Registry/TypeRegistry.php:316
  | 0.1693    9962472  20. WP_Hook->do_action() /var/www/web/wp/wp-includes/plugin.php:478
  | 0.1693    9962472  21. WP_Hook->apply_filters() /var/www/web/wp/wp-includes/class-wp-hook.php:312
  | 0.1694    9976632  22. WPGraphQLGutenberg\WPGraphQLGutenberg->WPGraphQLGutenberg\{closure:/var/www/web/app/plugins/wp-graphql-gutenberg/plugin.php:859-918}() /var/www/web/wp/wp-includes/class-wp-hook.php:288
  | 0.1694    9976632  23. WPGraphQLGutenberg\WPGraphQLGutenberg->get_graphql_block_typename_per_block_name() /var/www/web/app/plugins/wp-graphql-gutenberg/plugin.php:861
  | 0.1830   11881960  24. WPGraphQLGutenberg\WPGraphQLGutenberg->generate_graphql_block_type() /var/www/web/app/plugins/wp-graphql-gutenberg/plugin.php:572
  | 0.1830   11882328  25. WPGraphQLGutenberg\WPGraphQLGutenberg->generate_graphql_attributes_configs() /var/www/web/app/plugins/wp-graphql-gutenberg/plugin.php:494
  | 0.1831   11892080  26. WPGraphQLGutenberg\WPGraphQLGutenberg->generate_graphql_attributes_fields() /var/www/web/app/plugins/wp-graphql-gutenberg/plugin.php:388

Warning: Could not determine type of attribute "figureStyle" in "core/pullquote" block type. in /var/www/web/app/plugins/wp-graphql-gutenberg/plugin.php on line 313
  |  
  | Call Stack:
  | 0.0001     414240   1. {main}() /var/www/web/wp/index.php:0
  | 0.0001     414520   2. require('/var/www/web/wp/wp-blog-header.php') /var/www/web/wp/index.php:17
  | 0.1386    7786216   3. wp() /var/www/web/wp/wp-blog-header.php:16
  | 0.1386    7786264   4. WP->main() /var/www/web/wp/wp-includes/functions.php:1250
  | 0.1386    7786264   5. WP->parse_request() /var/www/web/wp/wp-includes/class-wp.php:729
  | 0.1394    7812888   6. do_action_ref_array() /var/www/web/wp/wp-includes/class-wp.php:387
  | 0.1394    7812888   7. WP_Hook->do_action() /var/www/web/wp/wp-includes/plugin.php:544
  | 0.1394    7812888   8. WP_Hook->apply_filters() /var/www/web/wp/wp-includes/class-wp-hook.php:312
  | 0.1394    7814016   9. WPGraphQL\Router->resolve_http_request() /var/www/web/wp/wp-includes/class-wp-hook.php:288
  | 0.1394    7814040  10. WPGraphQL\Router::process_http_request() /var/www/web/app/plugins/wp-graphql/src/Router.php:155
  | 0.1394    7880792  11. WPGraphQL\Request->__construct() /var/www/web/app/plugins/wp-graphql/src/Router.php:341
  | 0.1397    7895040  12. WPGraphQL::get_schema() /var/www/web/app/plugins/wp-graphql/src/Request.php:107
  | 0.1397    7897424  13. WPGraphQL\Registry\SchemaRegistry->get_schema() /var/www/web/app/plugins/wp-graphql/wp-graphql.php:527
  | 0.1397    7897424  14. WPGraphQL\Registry\TypeRegistry->init() /var/www/web/app/plugins/wp-graphql/src/Registry/SchemaRegistry.php:37
  | 0.1398    7921120  15. do_action() /var/www/web/app/plugins/wp-graphql/src/Registry/TypeRegistry.php:334
  | 0.1398    7921496  16. WP_Hook->do_action() /var/www/web/wp/wp-includes/plugin.php:478
  | 0.1398    7921496  17. WP_Hook->apply_filters() /var/www/web/wp/wp-includes/class-wp-hook.php:312
  | 0.1398    7922624  18. WPGraphQL\Registry\TypeRegistry->WPGraphQL\Registry\{closure:/var/www/web/app/plugins/wp-graphql/src/Registry/TypeRegistry.php:146-318}() /var/www/web/wp/wp-includes/class-wp-hook.php:288
  | 0.1693    9962096  19. do_action() /var/www/web/app/plugins/wp-graphql/src/Registry/TypeRegistry.php:316
  | 0.1693    9962472  20. WP_Hook->do_action() /var/www/web/wp/wp-includes/plugin.php:478
  | 0.1693    9962472  21. WP_Hook->apply_filters() /var/www/web/wp/wp-includes/class-wp-hook.php:312
  | 0.1694    9976632  22. WPGraphQLGutenberg\WPGraphQLGutenberg->WPGraphQLGutenberg\{closure:/var/www/web/app/plugins/wp-graphql-gutenberg/plugin.php:859-918}() /var/www/web/wp/wp-includes/class-wp-hook.php:288
  | 0.1694    9976632  23. WPGraphQLGutenberg\WPGraphQLGutenberg->get_graphql_block_typename_per_block_name() /var/www/web/app/plugins/wp-graphql-gutenberg/plugin.php:861
  | 0.1830   11881960  24. WPGraphQLGutenberg\WPGraphQLGutenberg->generate_graphql_block_type() /var/www/web/app/plugins/wp-graphql-gutenberg/plugin.php:572
  | 0.1830   11882328  25. WPGraphQLGutenberg\WPGraphQLGutenberg->generate_graphql_attributes_configs() /var/www/web/app/plugins/wp-graphql-gutenberg/plugin.php:494
  | 0.1831   11892080  26. WPGraphQLGutenberg\WPGraphQLGutenberg->generate_graphql_attributes_fields() /var/www/web/app/plugins/wp-graphql-gutenberg/plugin.php:388
  | 0.1834   11895064  27. trigger_error() /var/www/web/app/plugins/wp-graphql-gutenberg/plugin.php:313

The figureStyle seems to come from core/pullquote's deprecated functionality

[Feature Request] Additional metadata on media assets

I would be great if we could query modified attribute from Gutenberg blocks which relate to images and files. Doing so would provide the ability to cache-bust assets on the front-end and would be more consistent with options available on "file fields" from the wp-graphql-acf plugin.

For example:

... on WPGraphQL_CoreImageBlock {
      attributes {
        url
        modified

would return

{
  "attribute": {
    "url": "https://example.com/foo.jpg"
    "modified": "2020-03-09 17:44:44"
  }
}

Type CoreNextpageBlockAttributes must define one or more fields.

Hey,

I am working on the project of mine and I get the following error on clean WP installation with the latest version plugin. I use gatsby as my frontend application. I wonder if you have any clue what could cause it and how can I help to resolve the issue? I am more than happy to participate with some code if you can point me into the right direction.

"Type CoreNextpageBlockAttributes must define one or more fields."

Martin

Internal server error when quering blocks

Hi,

It's me again. I have updated the plugin to the latest version as well as pulled requested plugin dependencies:
WP GraphQL 0.9.1
WP GraphQL Gutenberg 0.3.1
WP GraphQL GutenbergACF 0.3.0

I can't query any block. I get the following response on page query no matter what client I use(Postman, GraphQL, Gatsby GraphQL Client)

  "errors": [
    {
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "locations": [
        {
          "line": 4,
          "column": 7
        }
      ],
      "path": [
        "pages",
        "nodes",
        0,
        "blocks"
      ]
    }
  ],
  "data": {
    "pages": {
      "nodes": [
        {
          "blocks": null,
          "id": "cG9zdDozODU="
        }
      ]
    }
  }
}

Example query:
query MyQuery { pages { nodes { id blocks { name } } } }

Kind regards,
Marcin

Fatal Error on WP 5.6.1

I have a installation of WP 5.6.1 on PHP 7.4.14, when I visit my graphql server endpoint https://circlej.smr-sandbox.com/graphql , I get the following error, can you help?

Fatal error: Uncaught WPGraphQLGutenberg\Blocks\RegistryNotSourcedException: Client side block registry is missing. You need to open up gutenberg or load it from WPGraphQLGutenberg Admin page. in /home/customer/www/circlej.smr-sandbox.com/public_html/wp-content/plugins/wp-graphql-gutenberg-0.3.7/src/Blocks/Registry.php:41 Stack trace: #0 /home/customer/www/circlej.smr-sandbox.com/public_html/wp-content/plugins/wp-graphql-gutenberg-0.3.7/src/Schema/Types/BlockTypes.php(253): WPGraphQLGutenberg\Blocks\Registry::get_registry() #1 /home/customer/www/circlej.smr-sandbox.com/public_html/wp-includes/class-wp-hook.php(287): WPGraphQLGutenberg\Schema\Types\BlockTypes->WPGraphQLGutenberg\Schema\Types{closure}(Object(WPGraphQL\Registry\TypeRegistry)) #2 /home/customer/www/circlej.smr-sandbox.com/public_html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array) #3 /home/customer/www/circlej.smr-sandbox.com/public_html/wp-includes/plugin.php(484): WP_Hook->do_action(Array) #4 /home/customer/www/circlej.smr-sandbox.c in /home/customer/www/circlej.smr-sandbox.com/public_html/wp-content/plugins/wp-graphql-gutenberg-0.3.7/src/Blocks/Registry.php on line 41

ACF Blocks intermittently not populating to schema

What I did

  • Created and registered ACF blocks with fields in Custom Fields
  • Added them to a page
  • Updated block registry
  • Visited the graphiQL IDE

What I expected

  • The ACF blocks would consistently appear in the schema

What happened

  • Sometimes the blocks are appearing and sometimes they aren't.

What I'm running:

WP 5.6 with the following enabled plugins
Screenshot 2021-01-18 at 10 22 32

Note:

  • This has been working previously but when I tried rolling back versions the intermittent appearance of the blocks persisted. I can't work out why they are sometimes appearing.

500 error with wordpress 5.6

Hi, we have a 500 error with the last version of WP Graphql Gutenberg plugin : PHP Fatal error: Uncaught Error: Cannot use object of type GraphQL\Type\SchemaConfig as array in \wp-content\plugins\wp-graphql-gutenberg\plugin.php:1080

And we have not access to graphql endpoint, we have 500 too on the site.com/graphql, but when we deactivate WP GraphQL Gutenberg, all is ok

Revisions Blocks not populated

On revisions, blocks do not get resolved data when you use saveContent the data comes in

See example:

{
  "data": {
    "pageBy": {
      "title": "Test Page 2",
      "pageId": 544,
      "revisions": {
        "nodes": [
          {
            "content": "\n<div class=\"wp-block-cover has-background-dim\" style=\"background-image:url(http://localhost:8080/app/uploads/2019/11/1000-24.jpg)\"><div class=\"wp-block-cover__inner-container\">\n<p style=\"text-align:center\" class=\"has-large-font-size\">Test Page edited HI</p>\n</div></div>\n\n\n\n\n\n\n\n<p></p>\n",
            "blocks": []
          },
          {
            "content": "\n<div class=\"wp-block-cover has-background-dim\" style=\"background-image:url(http://localhost:8080/app/uploads/2019/11/1000-24.jpg)\"><div class=\"wp-block-cover__inner-container\">\n<p style=\"text-align:center\" class=\"has-large-font-size\">Test Page edited sdd</p>\n</div></div>\n\n\n\n\n\n\n\n<p></p>\n",
            "blocks": []
          },
          {
            "content": "\n<div class=\"wp-block-cover has-background-dim\" style=\"background-image:url(http://localhost:8080/app/uploads/2019/11/1000-24.jpg)\"><div class=\"wp-block-cover__inner-container\">\n<p style=\"text-align:center\" class=\"has-large-font-size\">Test Page edited 2</p>\n</div></div>\n\n\n\n\n\n\n\n<p></p>\n",
            "blocks": []
          },
          {
            "content": "\n<div class=\"wp-block-cover has-background-dim\" style=\"background-image:url(http://localhost:8080/app/uploads/2019/11/1000-24.jpg)\"><div class=\"wp-block-cover__inner-container\">\n<p style=\"text-align:center\" class=\"has-large-font-size\">Test Page edited</p>\n</div></div>\n\n\n\n\n\n\n\n<p></p>\n",
            "blocks": []
          },
          {
            "content": "\n<div class=\"wp-block-cover has-background-dim\" style=\"background-image:url(http://localhost:8080/app/uploads/2019/11/1000-24.jpg)\"><div class=\"wp-block-cover__inner-container\">\n<p style=\"text-align:center\" class=\"has-large-font-size\">Test Page</p>\n</div></div>\n\n\n\n\n\n\n\n<p></p>\n",
            "blocks": []
          },
          {
            "content": "\n<div class=\"wp-block-cover has-background-dim\" style=\"background-image:url(http://localhost:8080/app/uploads/2019/11/1000-24.jpg)\"><div class=\"wp-block-cover__inner-container\">\n<p style=\"text-align:center\" class=\"has-large-font-size\">Test Page</p>\n</div></div>\n\n\n\n\n\n\n\n<p></p>\n",
            "blocks": []
          },
          {
            "content": "\n<div class=\"wp-block-cover has-background-dim\" style=\"background-image:url(http://localhost:8080/app/uploads/2019/11/1000-24.jpg)\"><div class=\"wp-block-cover__inner-container\">\n<p style=\"text-align:center\" class=\"has-large-font-size\">Test Page</p>\n</div></div>\n\n\n\n\n\n\n\n<p></p>\n",
            "blocks": []
          },
          {
            "content": "\n<div class=\"wp-block-cover has-background-dim\" style=\"background-image:url(http://localhost:8080/app/uploads/2019/11/1000-24.jpg)\"><div class=\"wp-block-cover__inner-container\">\n<p style=\"text-align:center\" class=\"has-large-font-size\">Test Page</p>\n</div></div>\n\n\n\n\n\n\n\n<p></p>\n",
            "blocks": []
          },
          {
            "content": "\n<div class=\"wp-block-cover has-background-dim\" style=\"background-image:url(http://localhost:8080/app/uploads/2019/11/1000-24.jpg)\"><div class=\"wp-block-cover__inner-container\">\n<p style=\"text-align:center\" class=\"has-large-font-size\">Test Page</p>\n</div></div>\n\n\n\n\n\n\n\n<p></p>\n",
            "blocks": []
          },
          {
            "content": "\n<div class=\"wp-block-cover has-background-dim\" style=\"background-image:url(http://localhost:8080/app/uploads/2019/11/1000-24.jpg)\"><div class=\"wp-block-cover__inner-container\">\n<p style=\"text-align:center\" class=\"has-large-font-size\">Test Page</p>\n</div></div>\n\n\n\n\n\n\n\n<p></p>\n",
            "blocks": []
          }
        ]
      },
      "blocks": [
        {
          "saveContent": "<div class=\"wp-block-cover has-background-dim\" style=\"background-image:url(http://localhost:8080/app/uploads/2019/11/1000-24.jpg)\"><div class=\"wp-block-cover__inner-container\"><!-- wp:paragraph {\"align\":\"center\",\"placeholder\":\"Write title…\",\"fontSize\":\"large\"} -->\n<p style=\"text-align:center\" class=\"has-large-font-size\">Test Page edited sdd</p>\n<!-- /wp:paragraph --></div></div>",
          "name": "core/cover"
        },
        {
          "saveContent": "",
          "name": "lndev-blocks/post-list-by-category"
        },
        {
          "saveContent": "",
          "name": "lndev-blocks/post-list-by-category"
        },
        {
          "saveContent": "<p></p>",
          "name": "core/paragraph"
        }
      ]
    }
  }
}

query

# Try to write your query here
query {
  pageBy(pageId: 544) {
    title
    pageId
    revisions{
      nodes{
        content
        blocks{
          name
          saveContent
        }
      }
    }
    blocks{
      saveContent
      name
          
    }
  }
}

Attributes with type "object" returned as string

Block attributes that have the type set to "object" are returned as a string, both in the default blocks and in custom blocks. Is there a way around this?

I've tried defining properties on the attribute on a custom block but that makes no difference.

An example from the default blocks is the media-text block that has a focal point attribute. When I try that in the graphql editor it returns a string like this "focalPoint": "{\"x\":\"0.19\",\"y\":\"0.72\"}"

If it's possible to solve this and someone can point me in the right direction I'd be happy to look into making a pull request.

Unable to create/update pages with block type "Cover"

Hi there!

Thanks for putting this together, so far it's been working quite well for me for the block types I've tried so far.

The block type "cover" however seems to not be working correctly, however. Any create/update of a page with this built in block gets stuck loading, and doesn't finish. The content is also not updated, proving to be a bit of a blocker.

There is an error message that is presented when loading hangs

PHP Notice:  Undefined variable: post in /var/www/html/wp-content/plugins/a/plugin.php on line 680

Finding this line in the code, I suppose it is possible for $post to be undefined as it is a parameter of the calling function and potentially simply nothing passed in. Unfortunately I can't get a stack trace out to give you more detail. Also not sure if this is the root cause or just a coincidence either, as it is just a warning I don't think it is throwing here.

WordPress: 5.2.2
PHP: 7.2
wp-graphql-gutenberg: 0.0.2
Docker Image: https://hub.docker.com/_/wordpress - wordpress:5-php7.2 (Alpine Linux)

Fields seem to be missing

Expected Behavior

An attributes field is available on blocks

Current Behavior

The only fields available are

isValid
name
originalContent
innerBlocks

Steps to Reproduce

  1. Install WP GraphQL, WP GraphQL Gutenberg & WP GraphiQL
  2. Edit and update the only post
  3. Explore using GraphiQL

image

Context

A fresh install no other plugins, on dev environment, WordPress fpm and nginx.

I'm available on https://wp-graphql.slack.com ( join ) if I can be of any help. Thanks,

Post content not filtered

A lot of plugins populates the content in WordPress' the_content filter. Since this plugin accesses post_content directly, we can't get the filtered output. I'm not sure if this is by intention, but plugins like Offload Media, which changes the asset URLs in this filter, doesn't work well together with this plugin.

I would like to make a PR, but I'm not sure which implementation you would like more:

  • Option 1: always return filtered content
  • Option 2: introduce a new field beside blocks and blocksJson: blocksFiltered

Any feedback would be appreciated 😄

Backslash not being returned within content

The backslash character (\) is not being returned within block values. For example, if I have a paragraph block with only a backslash in it, the returned value of originalContent is just <p></p>. Similarly, if I have a level 2 heading block with a value of ABC \ 123, the returned value of originalContent is <h2>ABC 123</h2>. I have not tested on other core blocks, but I assume they will have similar results. It seems like the backslashes need to be escaped in their return values? As a note, the title field being handled by wp-graphql returns values with escaped characters (i.e. a page title of Page \ Title will return "title": "Page \\ Title").

This was tested on WordPress 5.2.4, and latest versions of wp-graphql and wp-graphql-gutenberg.

ACF Block data in blocksJSON

I have created a ACF Block which basically consists of a select field that I then do some filtering with by the return value. So far so good and everything works as expected if I query my block as in this image:

Screenshot 2021-03-15 at 19 07 21

But this is not how I've wired my application, instead I want to make use of blocksJSON to parse my data. The problem is that blocksJSON doesn't return an equivalent value as dynamicContent does in the previous image. Here I've filled a page with a standard Gutenberg paragraph block and my custom ACF Block just to show the result:

Screenshot 2021-03-15 at 18 59 32

If i could get the ACF data to show up like the paragraph content does it would totally solve my issue :)

Unable to run Gutenberg Admin

When I try to update all my posts to be ready for the plugin, I get the following error on the third posts.

Failed to update post with id 1716. The response is not a valid JSON response.

WP version: 5.2.3

Warning ! heuristic fragment matching going on !

Hello, great extension !
I query the post as in your example using fragment... but I then I got this error !
By the way, i'm trying to loop over the blocks and use matching name components. This is fine but instead of accessing the raw content of the block (which I could if the queries with fragment would work) I ended up doing some bad regex based extraction to get the source of an image block for example...
I've read that I should use "IntrospectionFragmentMatcher" but it is way out of my skills is there a way to silence this warning as this request is just to display some part of the post and will never alter the post... The funny thing is that with graphiql, within worpdress, the queries works without warning.
Or, do you have simple example with this "introspectionFragmentMatcher" ?
Capture d’écran 2019-11-11 à 00 44 20
Thank you anyway.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.