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

Querying a relationships group fields returns null in GraphQL #4556

Closed
DanWebb opened this issue Nov 20, 2019 · 4 comments · Fixed by #5519
Closed

Querying a relationships group fields returns null in GraphQL #4556

DanWebb opened this issue Nov 20, 2019 · 4 comments · Fixed by #5519
Labels
issue: bug Issue reporting a bug severity: medium If it breaks the basic use of the product but can be worked around source: plugin:graphql Source is plugin/graphql package status: confirmed Confirmed by a Strapi Team member or multiple community members

Comments

@DanWebb
Copy link

DanWebb commented Nov 20, 2019

Describe the bug
Using graphql, when querying a relationship + a group field inside the relationship the group field returns null.

For example...

query group_fields_in_relationship {
  parent(where: { some_prop: "some_value" }) {
    id
    related_content_type {
      group_field {
        title
      }
    }
  }
}

parent.related_content_type.group_field will be null

But, if I query the related_content_type directly the group_field returns correctly.

Steps to reproduce the behavior

  1. Create a group field and add it to a content type
  2. Relate the content type with a group field in it to another content type
  3. Try to query the group field through the content type relationship
  4. See the group fielod in the query return null

Expected behavior
The group field to return what it contains

System

  • Node.js version: 12.6.0
  • NPM version: 6.9.0
  • Strapi version: 3.0.0-beta.17.5
  • Database: postgres
  • Operating system: macOS mojave
@lauriejim lauriejim added severity: medium If it breaks the basic use of the product but can be worked around status: confirmed Confirmed by a Strapi Team member or multiple community members issue: bug Issue reporting a bug labels Nov 20, 2019
@lauriejim
Copy link
Contributor

Hello @DanWebb !

Thank you for this report! I can confirm this issue.
We will do our best.

@lynnReilaender
Copy link

lynnReilaender commented Dec 4, 2019

Comment on that, since I think it's related: Also the JSON response via REST API does not contain group based fields or the group reference itself within the relationships.

(And: Groups are really a cool feature.)

See also #4459.

@gavinwilliams
Copy link

gavinwilliams commented Dec 4, 2019

Would be good to get an ETA on this or whether anyone is working on it. It's a bit of a blocker. Happy to jump in and give it a go!

@lauriejim
Copy link
Contributor

If you are using the REST API - here is a workaround.
Custom populate relations

@lauriejim lauriejim changed the title Querying a relationships group fields returns null Querying a relationships group fields returns null in GraphQL Feb 11, 2020
@lauriejim lauriejim added the source: plugin:graphql Source is plugin/graphql package label Feb 11, 2020
petersg83 pushed a commit that referenced this issue Mar 16, 2020
…ationGraphQl

Signed-off-by: Pierre Noël <pierre.noel@strapi.io>
alexandrebodin added a commit that referenced this issue Mar 17, 2020
…onentInRelationGraphQl

fix(graphql): null when requiring a component in relation graph ql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug Issue reporting a bug severity: medium If it breaks the basic use of the product but can be worked around source: plugin:graphql Source is plugin/graphql package status: confirmed Confirmed by a Strapi Team member or multiple community members
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants