doums
10/24/2018, 6:08 PMtype PostSubscriptionPayload {
mutation: MutationType!
node: Post
updatedFields: [String!]
previousValues: PostPreviousValues
}
Because when I try with something like that in the resolver return ...prisma.$<http://subscribe.post|subscribe.post>()
and I console log the returned payload of this, I get PostSubscriptionPayload
but only updatedFields
and mutation
fields are set correctly, the other fields remains null, whatever is the event (creation, delete, update).
Second problem, and this is a big one because it concerns the DELETE subscription, we can't get back the previous value of the deleted node at all! If I try ctx.prisma.$<http://subscribe.post|subscribe.post>({ mutation_in: ['DELETED'] }).previousValues()
with
type Subscription {
deletedPost: PostPreviousValues! // I tested with Post! too, same error
}
I get null
Note that I console log the payload in the resolve
function of each subscription resolver like
deletedPost: {
subscribe: async (parent, args, ctx) => {
return ctx.prisma.$<http://subscribe.post|subscribe.post>({ mutation_in: ['DELETED'] }).previousValues()
},
resolve: payload => {
console.log(payload)
return payload
}
}
So I'm pretty sure the problem comes from prisma Client 🤪
prisma 1.19 (docker image as well)