From e30e4edfce661204a1e815859b5e7ac8b4d18b2f Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Sun, 3 Oct 2021 01:31:06 +0530 Subject: [PATCH] fix: fix issue with team queries not updating correctly after mutation --- packages/hoppscotch-app/helpers/backend/GQLClient.ts | 9 +++++++-- .../hoppscotch-app/helpers/backend/mutations/Team.ts | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/hoppscotch-app/helpers/backend/GQLClient.ts b/packages/hoppscotch-app/helpers/backend/GQLClient.ts index cf8fd2335..6613d7a6f 100644 --- a/packages/hoppscotch-app/helpers/backend/GQLClient.ts +++ b/packages/hoppscotch-app/helpers/backend/GQLClient.ts @@ -12,6 +12,7 @@ import { TypedDocumentNode, OperationResult, defaultExchanges, + OperationContext, } from "@urql/core" import { devtoolsExchange } from "@urql/devtools" import * as E from "fp-ts/Either" @@ -171,11 +172,15 @@ export const runMutation = < MutationVariables extends {} = {} >( mutation: string | DocumentNode | TypedDocumentNode, - variables?: MutationVariables + variables?: MutationVariables, + additionalConfig?: Partial ): TE.TaskEither, NonNullable> => pipe( TE.tryCatch( - () => client.mutation(mutation, variables).toPromise(), + () => + client + .mutation(mutation, variables, additionalConfig) + .toPromise(), () => constVoid() as never // The mutation function can never fail, so this will never be called ;) ), TE.chainEitherK((result) => diff --git a/packages/hoppscotch-app/helpers/backend/mutations/Team.ts b/packages/hoppscotch-app/helpers/backend/mutations/Team.ts index 1002c59fe..c761cf47d 100644 --- a/packages/hoppscotch-app/helpers/backend/mutations/Team.ts +++ b/packages/hoppscotch-app/helpers/backend/mutations/Team.ts @@ -52,6 +52,9 @@ export const deleteTeam = (teamID: string) => `, { teamID, + }, + { + additionalTypenames: ["Team"], } ) @@ -64,5 +67,8 @@ export const leaveTeam = (teamID: string) => `, { teamID, + }, + { + additionalTypenames: ["Team"], } )