Merge pull request #4296 from strapi/fix/graphql-many-many-nested

Check if many-many relation is populated before loading it
This commit is contained in:
Alexandre BODIN 2019-10-22 10:09:08 +02:00 committed by GitHub
commit 2e04629c31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -165,8 +165,9 @@ const buildAssocResolvers = (model, name, { plugin }) => {
};
if (
(association.nature === 'manyToMany' && association.dominant) ||
association.nature === 'manyWay'
((association.nature === 'manyToMany' && association.dominant) ||
association.nature === 'manyWay') &&
_.has(obj, association.alias) // if populated
) {
_.set(
queryOpts,