fix: fix issue with team queries not updating correctly after mutation
This commit is contained in:
committed by
liyasthomas
parent
bd72ef7950
commit
e30e4edfce
@@ -12,6 +12,7 @@ import {
|
|||||||
TypedDocumentNode,
|
TypedDocumentNode,
|
||||||
OperationResult,
|
OperationResult,
|
||||||
defaultExchanges,
|
defaultExchanges,
|
||||||
|
OperationContext,
|
||||||
} from "@urql/core"
|
} from "@urql/core"
|
||||||
import { devtoolsExchange } from "@urql/devtools"
|
import { devtoolsExchange } from "@urql/devtools"
|
||||||
import * as E from "fp-ts/Either"
|
import * as E from "fp-ts/Either"
|
||||||
@@ -171,11 +172,15 @@ export const runMutation = <
|
|||||||
MutationVariables extends {} = {}
|
MutationVariables extends {} = {}
|
||||||
>(
|
>(
|
||||||
mutation: string | DocumentNode | TypedDocumentNode<any, MutationVariables>,
|
mutation: string | DocumentNode | TypedDocumentNode<any, MutationVariables>,
|
||||||
variables?: MutationVariables
|
variables?: MutationVariables,
|
||||||
|
additionalConfig?: Partial<OperationContext>
|
||||||
): TE.TaskEither<GQLError<MutationFailType>, NonNullable<MutationReturnType>> =>
|
): TE.TaskEither<GQLError<MutationFailType>, NonNullable<MutationReturnType>> =>
|
||||||
pipe(
|
pipe(
|
||||||
TE.tryCatch(
|
TE.tryCatch(
|
||||||
() => client.mutation<MutationReturnType>(mutation, variables).toPromise(),
|
() =>
|
||||||
|
client
|
||||||
|
.mutation<MutationReturnType>(mutation, variables, additionalConfig)
|
||||||
|
.toPromise(),
|
||||||
() => constVoid() as never // The mutation function can never fail, so this will never be called ;)
|
() => constVoid() as never // The mutation function can never fail, so this will never be called ;)
|
||||||
),
|
),
|
||||||
TE.chainEitherK((result) =>
|
TE.chainEitherK((result) =>
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ export const deleteTeam = (teamID: string) =>
|
|||||||
`,
|
`,
|
||||||
{
|
{
|
||||||
teamID,
|
teamID,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
additionalTypenames: ["Team"],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -64,5 +67,8 @@ export const leaveTeam = (teamID: string) =>
|
|||||||
`,
|
`,
|
||||||
{
|
{
|
||||||
teamID,
|
teamID,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
additionalTypenames: ["Team"],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user