-
Notifications
You must be signed in to change notification settings - Fork 106
Closed
Labels
Description
Expected behaviour:
Fields defined in fragments are automatically prepended to info query.
Actual behaviour:
Fields defined in fragments are not automatically prepended to info query, which causes certain resolvers to return wrong data.
Recreation:
query {
homesInPriceRange(min: 0, max: 9000) {
name
numRatings
}
}numRatingsis always zero, becauseidis undefined.
numRatings: {
fragment: `fragment NumRatings on Place { id }`,
resolve: async (parent, args, ctx: Context, info) => {
console.log(parent);
const reviews = await ctx.db.query.reviewsConnection(
{ where: { place: { id: parent.id } } },
`{ aggregate { count } }`,
)
return reviews.aggregate.count
},
},Example of parent log:
{ name: 'Romantic, Cozy Cottage Next to Downtown' }