sweepai-dev / apollo-client

:rocket:  A fully-featured, production ready caching GraphQL client for every UI framework and GraphQL server.
https://apollographql.com/client
MIT License
0 stars 0 forks source link

[DRAFT] [3.8] Document new `removeTypenameFromVariables` link #8

Open sweep-ai[bot] opened 1 year ago

sweep-ai[bot] commented 1 year ago

With the addition of https://github.com/apollographql/apollo-client/pull/10853, we need to add documentation for this new Apollo Link. The API is captured in the PR description.

removeTypenameFromVariables Link

The removeTypenameFromVariables link is a new feature introduced in Apollo Client 3.8. By default, this link removes all __typename keys from variables. However, it can be configured to keep __typename in certain fields.

Here is an example of how to use it:

import { removeTypenameFromVariables, KEEP } from '@apollo/client/link/remove-typename';

const link = removeTypenameFromVariables({
  except: {
    JSON: KEEP,
    FooInput: {
      bar: KEEP,
      baz: KEEP,
    },
  }
});

In the example above, all __typename keys are removed from variables except for those that are declared as a JSON type or are bar or baz fields on any variable declared as a FooInput type.

Closes https://github.com/apollographql/apollo-client/issues/10767

Fixes #4.

To checkout this PR branch, run the following command in your terminal:

git checkout sweep/document-remove-typename-link