feat: add subscription support for useGQLQuery

This commit is contained in:
Andrew Bastin
2021-10-27 22:41:32 +05:30
parent 4b0d7a6c3d
commit ddd29374ea
4 changed files with 85 additions and 33 deletions

View File

@@ -1,6 +1,44 @@
import { GraphCacheUpdaters, MyTeamsDocument } from "../graphql"
export const updatesDef: GraphCacheUpdaters = {
Subscription: {
teamMemberAdded: (_r, { teamID }, cache, _info) => {
debugger
cache.invalidate(
{
__typename: "Team",
id: teamID,
},
"teamMembers"
)
},
teamMemberUpdated: (_r, { teamID }, cache, _info) => {
cache.invalidate(
{
__typename: "Team",
id: teamID,
},
"teamMembers"
)
cache.invalidate(
{
__typename: "Team",
id: teamID,
},
"myRole"
)
},
teamMemberRemoved: (_r, { teamID }, cache, _info) => {
cache.invalidate(
{
__typename: "Team",
id: teamID,
},
"teamMembers"
)
},
},
Mutation: {
deleteTeam: (_r, { teamID }, cache, _info) => {
cache.updateQuery(