Replies: 1 comment
-
@gotenxds any success so far? I'm running into the same issue, where I've got two queries on two separate components (one remote & one local - cache only). The remote is being triggered manually and the local is running automatically. Problem is, the local one isn't refetching in case the cache was empty but was filled with the remote. With Vuex, this would be easily solved via getter. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, i'm trying to move to using apollo local cache instead of vuex, but I cant understand how to emulate getters
I have some data on the cache lets say person
Ok great, if I use the $apollo get from the component each time it changes I will get an update.
But how do I create a complex getter ?
If I make a resolver, lets say
const uppercasedPerson= (_, _args, {cache}) => {
const { person } = cache.readQuery({ query: getPersonQuery })
let uppercased = { ...person, name: person.name.toUpperCase() }
cache.writeQuery({ query: getPersonQuery, data: { person: uppercased }})
return uppercased;
};
again, this works if I query it from my component.
But if I change the name of the person with a mutation, then the `uppercasedPerson' wont get called again.
How can I achive this getter like functionality?
Beta Was this translation helpful? Give feedback.
All reactions