-In Server-side Subscription: When a relation is b...
# prisma-whats-new
b
-In Server-side Subscription: When a relation is broken is no subscription is triggered. So is there any way to get "previous data" of the node that did fire (and broke the relation) => then use that data to find the past relation for logic on the other node? Maybe I could take the logic back to clean up the node that did not fire on the server-side subscription? I know delete returns previous data. Maybe there is a built in prev field on all nodes? -Thanks
n
@brad.barnes may I ask how you are disconnecting the relation?
is it directly using
unsetRelation
or
removeFromRelation
?
b
Update mutation on the first node
n
so it's a one-to-one relation?
b
one to many, but the update is always on the one
n
Gotcha - right now there's no way to get the previous node without querying it first
b
:(
I was hoping to do this on a server-side subscription.
I think there would be a lot of use cases if the mutations and subscriptions nested a prev object in the model/node return value. I think I could solve most every data issue I ever had in GC with my own callbacks. Can I request a feature?
n
the main limitation you're experiencing right now, is that there are no relation triggers for subscriptions: https://github.com/graphcool/feature-requests/issues/146
The payload for subscriptions DO have a "previousFields" node-field
b
Awesome, I was just missing something 🤗 Thank you so much for your help 😀
n
Great, let me know if you need further help 😄