apollo-remove-typename-mutation-link
TypeScript icon, indicating that this package has built-in type declarations

3.3.9 • Public • Published

apollo-remove-typename-mutation-link

Link to remove __typename on mutations only for apollo client v3. It is very important to keep __typename on queries but for mutation it is more a pain to remove this key during data manipulation.

This library will automatically remove every nested __typename key it finds in the variables given to apollo mutation.

Installation

Using NPM

  npm install apollo-remove-typename-mutation-link

Using Yarn

  yarn add apollo-remove-typename-mutation-link

Then import removeTypenameFromMutationLink and add it at the beginning of your link concatenation.

import { ApolloClient, createHttpLink } from '@apollo/client';
import { removeTypenameFromMutationLink } from 'apollo-remove-typename-mutation-link';

const httpLink = createHttpLink({ uri: process.env.REACT_APP_BASE_URL_API });

const link = from([removeTypenameFromMutationLink, myOtherLink, httpLink]);

const client = new ApolloClient({
  // cache,
  link,
});

Issues

If you find a bug, please file an issue on our issue tracker on GitHub.

Package Sidebar

Install

npm i apollo-remove-typename-mutation-link

Weekly Downloads

206

Version

3.3.9

License

MIT

Unpacked Size

19.5 kB

Total Files

12

Last publish

Collaborators

  • redaboumahdi