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

[GraphQL Plugin] Component appears null when queried via one-to-many relationship, from different content type #5540

Closed
adrienharnay opened this issue Mar 19, 2020 · 2 comments

Comments

@adrienharnay
Copy link

Hello,

Describe the bug

My initial goal is to create several groups of articles, with several articles in each of them. Thefore, I have 2 content types :

  • articles (plural)
  • article (singular)

articles has two fields:

  • highlighted_child: one-to-one relation from articles to article
  • children: one-to-many relation from articles to article

article has three fields:

  • image: component with several fields (an image name, a media, ...)
  • parent: one-to-one relation from article to articles
  • similar_articles: one-to-many relation from article to article

The following query (direct access):

query {
  strapi {
    articles {
      image { name }
    }
  }
}

Works, image is defined

The following query (access through one-to-many relationship, same content type):

query {
  strapi {
    articles {
      similar_articles {
        image { name }
      }
    }
  }
}

Works, image is defined

The following query (access through one-to-many relationship, different content type):

query {
  strapi {
    articleses {
      children {
        image { name }
      }
    }
  }
}

Doesn't work, image is null

Oddly, the following query (access through one-to-one then one-to-many relationship, same then different content type):

query {
  strapi {
    articles {
      parent {
        children {
          image { name }
        }
      }
    }
  }
}

Works, image is defined

Steps to reproduce the behavior

  1. Bootstrap a fresh project with latest strapi version
  2. Create content types and fields as I described before
  3. Install the GraphQL plugin
  4. Paste the queries I provided

Expected behavior
The relation should not be broken while accessed from a one-to-many relationship, from a different content type (I believe this is what is happening).

System

  • Node.js version: 12.14.1
  • NPM version: 6.13.4
  • Strapi version: Strapi v3.0.0-beta.19.3
  • Database: postgresql
  • Operating system: macos

Thanks in advance!

@adrienharnay
Copy link
Author

Ah, just saw #5519 fixed it! Any idea when beta.19.4 will be released?

@derrickmehaffy
Copy link
Member

Probably sometime early next week if I had to guess, few other PRs pending for it..

Anyway gonna mark this as closed since new release will fix it (and pr already 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

2 participants