apollo-cache-inmemory

#[apollo-cache-persist] purged cached data | apollo-cache-persist Error | apollo-cache-persist not working

半世苍凉 提交于 2021-01-07 02:37:30
问题 This is the code I have used for cache persistance using 'apollo3-cache-persist', seems to have automatically purge the cached data after initial caching. Purging causes everything in the storage used for persistence to be cleared. Hence resulting in not persisting. import { persistCache, LocalStorageWrapper, LocalForageWrapper } from 'apollo3-cache-persist'; const httpLink = createHttpLink({ uri: 'http://localhost:4000/' }); const cache = new InMemoryCache(); persistCache({ cache, storage:

#[apollo-cache-persist] purged cached data | apollo-cache-persist Error | apollo-cache-persist not working

北城以北 提交于 2021-01-07 02:36:51
问题 This is the code I have used for cache persistance using 'apollo3-cache-persist', seems to have automatically purge the cached data after initial caching. Purging causes everything in the storage used for persistence to be cleared. Hence resulting in not persisting. import { persistCache, LocalStorageWrapper, LocalForageWrapper } from 'apollo3-cache-persist'; const httpLink = createHttpLink({ uri: 'http://localhost:4000/' }); const cache = new InMemoryCache(); persistCache({ cache, storage:

Call a fetch API which is stored once in using apollo cache?

◇◆丶佛笑我妖孽 提交于 2020-01-07 08:18:56
问题 I have been working on Apollo GQL. I'm using apollo cache to reduce unwanted API calls. The probelm now I'm facing is when i have updated a data i should not re-fetch the data because the API is already called once and stored in cache. Thing i wanted to do is either clear cache for a particular query or refetch the datas from server.!! I can't clear the entire cache, cause i'm calling a lot of APIs i have to re-fetch the data after the following mutation call. const [ reopenInvoice, { loading

Does the Apollo client cache nested objects in React?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 18:39:33
问题 Take the following queries: query Foo { foo { id bar(id: 1) { id baz } } } query Bar { bar(id: 1) { id baz } } Sometimes, running the 2nd query gets me a cached version of bar . Other times, it doesn't, but I'm not sure if this is because the query is run multiples times or because that's the default behaviour of the Apollo client in React. 回答1: No, it doesn't (as of Nov 2019, at least). To put the bar object in the cache when running the Foo query, you need to create the in-memory cache like

Why do we need `cacheRedirects` at all?

给你一囗甜甜゛ 提交于 2019-12-11 08:15:05
问题 I read the docs on interacting with cached data and while I understand how cacheRedirects works, I'm a bit confused why it is needed in the first place. This is part of the reason why I asked this other question: Does the Apollo client cache nested objects in React? We know that the data is most likely already in the client cache, but because it's requested with a different query, Apollo Client doesn't know that. Why is that? Copy-pasting the example in the docs, for clarity: query ListView {