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

Compatability issue with WPGraphql 1.6+ #27

Open
tomgreeEn opened this issue Aug 20, 2021 · 8 comments
Open

Compatability issue with WPGraphql 1.6+ #27

tomgreeEn opened this issue Aug 20, 2021 · 8 comments

Comments

@tomgreeEn
Copy link

The plugin causes an error when attempting to run a taxQuery on a contentNode when using wpGraphQL 1.6.4.

Steps to reproroduce:

This query:

query MyQuery { contentNodes(where: {taxQuery: {relation: AND, taxArray: {field: SLUG, operator: AND, taxonomy: CATEGORY, terms: "watches"}}}) { nodes { ... on NodeWithTitle { title } } } }

Succeeds when using WPGraphql 1.5.9 but fails on 1.6.4 with the message:

Type loader is expected to return a callable or valid type "RootQueryToContentNodeConnectionWhereArgsTaxArray", but it returned null"

@tomgreeEn
Copy link
Author

On further inspection, the issue is not specific to this plugin - closing issue

@tomgreeEn tomgreeEn reopened this Aug 20, 2021
@tomgreeEn
Copy link
Author

tomgreeEn commented Aug 20, 2021

Further investigation confirms this is not specific to contentNodes and is reproducible using only wp-graphql & wp-graphql-tax-query with the updated query:

query MyQuery($taxArray: [RootQueryToPostConnectionWhereArgsTaxArray]!) {
  posts(where: {taxQuery: {relation: AND, taxArray: $taxArray}}) {
    nodes {
      ... on NodeWithTitle {
        title
      }
    }
  }
}

With variables:

{
  "taxArray": [{
    "field": "SLUG",
    "operator": "AND",
    "taxonomy": "CATEGORY",
    "terms": "shoes"
  }]
}

Error message:

Type loader is expected to return a callable or valid type "RootQueryToContentNodeConnectionWhereArgsTaxArray", but it returned null"

@Zinkutal
Copy link

Broken by wp-graphql/wp-graphql#2000
Btw, woocommerce was fixed two weeks ago wp-graphql/wp-graphql-woocommerce#537
Transfer from non-working lazy-loading types over to eager type loading

If not addressed, I will take a look at it next week

Offtopic: this extension should be a part of a core plugin, in the worst case a discouraging feature - due to performance issues. Not sure why it is still being not

@BenMcD0nald
Copy link

I think I'm getting the same problem trying to use variables...

GraphQL\Error\InvariantViolation: Type loader is expected to return a callable or valid type "RootQueryToVideoConnectionWhereArgsTaxArray", but it returned null

Did anyone work out what the issues is here?

@pushljupche
Copy link

Hi,

I'm getting the same error as above on a custom post type taxonomy.

Digging through the code I found out that graphql_input_fields hook is not called because there are no 'input' kind of objects registered in src/Registry/TypeRegistry.php::prepare_type. This seems to be related to the lazy loading input fields.

I still haven't worked out a solution but for now I have downgraded the plugin to 1.5.9.

@duffner
Copy link

duffner commented Dec 20, 2021

Hi, all, I'm also getting the same errors as above! I've since downgraded to 1.5.9 to resolve my issues, but i'd like to upgrade.

@duffner
Copy link

duffner commented Jan 17, 2022

WP-GraphQL team, this is a pretty active issue being reported in the WP-GraphQL slack, and here. Has there been any attention given to this?

@Zinkutal
Copy link

Hi, @duffner, I got lazy 🙃, but needed to fix this quickly.

So, I have created a patch for WPGraphQL - https://gist.github.com/Zinkutal/4d7670f504993d7ff3e8f5bd6167334c

Beware of type changes, ex:

  • RootQueryToPostConnectionWhereArgsTaxArray ~> TaxonomyArrayInput
  • etc.

Waiting for wp-graphql/wp-graphql#1387 to be merged

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

No branches or pull requests

5 participants