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.
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
LinkThe
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:
In the example above, all
__typename
keys are removed from variables except for those that are declared as aJSON
type or arebar
orbaz
fields on any variable declared as aFooInput
type.Closes https://github.com/apollographql/apollo-client/issues/10767
Fixes #4.
To checkout this PR branch, run the following command in your terminal: