cache.modify() not a function
See original GitHub issueHello,
I have a problem with cache.modify() when trying to update the cache in a resolver with the v.3.0 beta @apollo/client version.
The chrome browser tells me that modify() is not a function: cache.identify is working.
Here is my code : `export const resolvers: any = {
Mutation: { updateApplicationProofUrl: (__:any, {input}:any, {cache, getCacheKey}:any) => { const {jobId, signedGetUrl} = input const id = cache.identify({ __typename: ‘Job’, id: jobId }) console.log(‘id’, id) cache.modify(id, {applicationProofUrl: signedGetUrl}) } }, }` Note : cache.identify() is working.
My cache is configured with this
// Graphql default state const cache = new InMemoryCache(); const link = new HttpLink({ uri: "http://localhost:5001" }) // GraphqlClient const client = new ApolloClient<NormalizedCacheObject>({ link, cache, typeDefs, resolvers, connectToDevTools: true })
Do you have an idea of the problem ?
It’s my first ever issue posting on any library so if it misses some info, don’t hesitate to tell me.
Thank you for your help !
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:13 (2 by maintainers)
Top GitHub Comments
Please note that https://www.apollographql.com/docs/react/data/mutations/ still refers to
cache.modify
in its examplesAye I’m seeing this in 3.2.7. I’m reasonably new to Apollo and while lots of the docs are great, I’ just so confused about how cache updates are meant to be done without
refetchQueries
. 🤯