benada002 / wp-graphql-widgets

This plugin adds widgets and sidebar queries to WPGraphQL.
13 stars 4 forks source link

WPGraphQL release 6.1 returns type error #3

Closed idesignzone closed 2 years ago

idesignzone commented 2 years ago

After updating to WPGraphQL 6.1 start getting an error for widget types Error: __typename did not match an object type: WPWidgetBlock

Last working version 1.5.9

benada002 commented 2 years ago

Will look into it asap.

benada002 commented 2 years ago

Do you've an example query for me? Or is the error happening without querying?

idesignzone commented 2 years ago

I am doing a sidebar query.

  sidebar(sidebar: SIDEBAR) {
    afterSidebar
    afterTitle
    afterWidget
    beforeSidebar
    beforeTitle
    beforeWidget
    class
    databaseId
    description
    id
    name
    widgets {
      edges {
        cursor
        node {
          databaseId
        }
      }
    }
  }

and when I delete all widgets from sidebar it works. but adding any widget to sidebar results in this error Error: __typename did not match an object type: WPWidgetBlock problem start appearing after this release https://github.com/wp-graphql/wp-graphql/releases/tag/v1.6.0

Lets also note that latest Wordpress has introduced Block widgets and excluded traditional Widgets.

benada002 commented 2 years ago

Which widgets/blocks are you using? I tried it with the image and text blocks and couldn't reproduce it with 1.6.1 and 1.6.2.

idesignzone commented 2 years ago

I made a minimum repo here (removed) This repo does produce the error with 1.6.2

benada002 commented 2 years ago

I'll try to look into it over the weekend.

benada002 commented 2 years ago

I'm updating the dependencies. I've to resolve some errors before pushing it.

benada002 commented 2 years ago

I updated the dependencies now in https://github.com/benada002/wp-graphql-widgets/pull/5 (branch: fix-1.6-compat ). Would you try if that's resolves the problem for you, since I can't reproduce it locally. Another question do have activated any other wp-graphql extensions/plugins? Because I noticed problems if you've activated one which has wp-graphql > 1.6 as dependency.

idesignzone commented 2 years ago

Tested with 1.6.2 and 1.6.4 and works with no error. Thank you very much.

benada002 commented 2 years ago

Thanks for testing. I'll merge it and release a new version tomorrow.