I have a query that I need to use in a number of places to get different information.
As such I define discrete documents for each graph I wish to fetch.
The issue arrises when a subscription updates the query’s data and the cache fires off the observable for all the documents referencing that query regardless of whether the document includes that information or not.
#Doc A
query groupName {
group {
id
name
_typename
}
}
#Doc B
query groupMembers {
group {
id
__typename
groupMembers {
name
id
__typename
}
}
}
#Sub - Modifies user details.
subscription groupMemberDetails {
user {
id
name
__typename
}
}
Updates coming down the socket that modify a user within the group cause both useQuery hooks to update state despite the update being irrelevant to Doc A.
Is there a way I can stop these re-renders?