Merge pull request #14695 from strapi/fix/process-populate-join-column-missing-select

Fix inline relations not being selected automatically when populated
This commit is contained in:
Jean-Sébastien Herbaux 2022-10-20 17:38:43 +02:00 committed by GitHub
commit 2a4d0ca6a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,7 +83,13 @@ const processPopulate = (populate, ctx) => {
continue;
}
// make sure id is present for future populate queries
// Make sure to query the join column value if needed,
// so that we can apply the populate later on
if (attribute.joinColumn) {
qb.addSelect(attribute.joinColumn.name);
}
// Make sure id is present for future populate queries
if (_.has('id', meta.attributes)) {
qb.addSelect('id');
}