:wave: a quick question regarding subscriptions (a...
# prisma-whats-new
l
👋 a quick question regarding subscriptions (and similar to a question asked by bobbyt on June 10th). Is it possible to subscribe to updates to a node that are then triggered by a change in a related node? In the example here (https://www.graph.cool/docs/reference/simple-api/subscribing-to-updated-nodes-ohmeta3pi4/#subscribe-to-all-updated-nodes), would it be possible to trigger the
updatePost
subscription when the associated Author is updated? Or would you always need to register two subscriptions?
n
@lewisblackwood currently you need to use two subscriptions indeed
l
ah I see, thanks! will it be possible to use one subscription in the future? 🙂 the handler becomes a bit tricky to implement when you need two subscriptions. For example, if you render ten posts and their authors, and then your author subscription triggers, are you supposed to iterate through each of those posts and update their author to return the next state? It would be great to just receive the post/posts affected by the change and replace them in the store. (<<< referring to the Apollo implementation here!) But I might be thinking about the approach incorrectly!
n
Do you have a separate
allAuthors
query or do you only query authors through their posts?
l
We only query authors through their posts
b
Is there an example of using 2 subscriptions? i.e., Author->Post, where any updates to Post will cause that posts User subscription to update?
I can get Author to work OR Post, but having trouble combining them
l
I have a working solution with two subscriptions now. But what about when you add another relation? For example, say
Author
has a relation to
Team
, so you render
allPosts
which queries the post's authors and the author's team. Do you then need create a third subscription to check if
Team
changes? It feels like really you just want to know if anything in the
node
query for your
Post
subscription has changed...
n
is it about an update of a team? In that case you could also query the team with that id again. That might be easier