I'm having trouble resolving graphql nested types. I can successfully get the UserMetrics nested resolver to fire, but the parent resolver object (user) is null. Am I misunderstanding the GraphQL resolver map?
Schema:
type User {
id: String!
metrics: UserMetrics
}
type UserMetrics {
lastLogin: String!
}
Resolver:
Query: {
user(_, { id }, ctx) {
return { id };
}
},
User: {
metrics(): ({}), // UserMetrics.lastLogin doesn't fire without this
},
UserMetrics: {
lastLogin(user) {
console.log(user); // null
}
},