loading...

re: Apollo state management in Vue application VIEW POST

FULL DISCUSSION
 

Hello Natalia, I followed your tut to get familiar with Apollo cache. Thx for that!

Maybe I missed it, but you are never adding the exported resolver to the options object when instantiating the ApolloClient object. So my resolver didn't work. After some debugging and research I found that resolvers: {} was still there and had to replaced with the resolvers we made further on.

For others:

In main.js

change

import { typeDefs } from './resolvers'

to

import { typeDefs, resolvers } from './resolvers'

and

const apolloClient = new ApolloClient({
  cache,
  typeDefs,
  resolvers: {},
})

to

const apolloClient = new ApolloClient({
  cache,
  typeDefs,
  resolvers,
})
 

Hi Peter! I do this in Creating a local schema part. There is a note there:

Please note the empty resolvers object here: if we don't assign it to the Apollo client options, it won't recognize the queries to local state and will try to send a request to remote URL instead

 

I was reading that as for now we assign an empty object, else we get in trouble :P

code of conduct - report abuse