apollo-client: Missing AC3 documentation improvements ☔

This issue tracks the docs items that weren’t completed in https://github.com/apollographql/apollo-client/pull/6429.

TODO:

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 19
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Would be good to get some more clarification around testing especially around client directives and reactive variables.

I’m looking for documentation for local-only mutations. I see there’s still a checkbox missing with the mutation example, but if someone could explain to me what I’m doing wrong, that would be great.

Our application makes use of the old local resolvers. Now I want to ‘update’ them to typePolicies. My old resolver looked like:

resolvers: {
         ....
        Mutation: {
           createCategorie(...)
        }
}

Now I changed it to this typePolicy:

const inMemoryCache = new InMemoryCache({
    typePolicies: {
        Query: {
            fields: {
                ....
            },
        },
        Mutation: {
            fields: {
                createCategorie(...) {
                    console.log('in create');
                }
            }
        },
       ...

the mutation gets called like this:

gql`
 mutation createCategorie(...) {
 createCategorie(...) @client
}`,

However the console.log never gets called. Is there something I’m missing?

edit: found my answer here: https://spectrum.chat/apollo/apollo-client/ac3-client-mutation~a0f064bf-731b-4129-8016-601217d45971

@dmitry I didn’t migrate from local mutation resolvers to reactive variables, but I threw away the local mutations and just did direct cache updates with read/writeQuery.

I think this issue about undefined old data when loading new data could use some love in the documentation / migration guides too.

@abdonrd We’re working on overhauling the main pagination section of the docs, but in the meantime you can find some details here: https://www.apollographql.com/docs/react/caching/cache-field-behavior/#handling-pagination