feat(front): Remove __typename from variables
When reusing data from a query as an argument to another GraphQL operation, __typename fields can cause errors. To avoid this, you can use the removeTypenameFromVariables link to automatically remove __typename fields from variables in operations. https://www.apollographql.com/docs/react/api/link/apollo-link-remove-typename
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
import { split } from "@apollo/client/core";
|
import { from, split } from "@apollo/client/core";
|
||||||
import { RetryLink } from "@apollo/client/link/retry";
|
import { RetryLink } from "@apollo/client/link/retry";
|
||||||
import { getMainDefinition } from "@apollo/client/utilities";
|
import { getMainDefinition } from "@apollo/client/utilities";
|
||||||
import absintheSocketLink from "./absinthe-socket-link";
|
import absintheSocketLink from "./absinthe-socket-link";
|
||||||
import { authMiddleware } from "./auth";
|
import { authMiddleware } from "./auth";
|
||||||
import errorLink from "./error-link";
|
import errorLink from "./error-link";
|
||||||
import { uploadLink } from "./absinthe-upload-socket-link";
|
import { uploadLink } from "./absinthe-upload-socket-link";
|
||||||
|
import { removeTypenameFromVariables } from "@apollo/client/link/remove-typename";
|
||||||
|
|
||||||
let link;
|
let link;
|
||||||
|
|
||||||
@@ -34,7 +35,10 @@ if (!import.meta.env.VITE_HISTOIRE_ENV) {
|
|||||||
|
|
||||||
const retryLink = new RetryLink();
|
const retryLink = new RetryLink();
|
||||||
|
|
||||||
export const fullLink = retryLink
|
export const fullLink = from([
|
||||||
.concat(errorLink)
|
removeTypenameFromVariables(),
|
||||||
.concat(authMiddleware)
|
retryLink,
|
||||||
.concat(link ?? uploadLink);
|
errorLink,
|
||||||
|
authMiddleware,
|
||||||
|
link ?? uploadLink,
|
||||||
|
]);
|
||||||
|
|||||||
Reference in New Issue
Block a user