client.clearStore is not a function?? How?
See original GitHub issueFirst, read your own docs https://www.apollographql.com/docs/react/advanced/caching.html#reset-store
If you want to clear the store but don’t want to refetch active queries, use client.clearStore() instead of client.resetStore().
Intended outcome:
Clear cache
Actual outcome:
this.props.client.clearStore is not a function
How to reproduce the issue:
this.props.client.clearStore().then( res => {
console.log('[res]', res);
} )
.catch( err => {
console.log('[err]', err);
})
Versions
System:
OS: macOS High Sierra 10.13.4
Binaries:
Node: 8.11.3 - /usr/local/bin/node
npm: 5.6.0 - /usr/local/bin/npm
Browsers:
Chrome: 68.0.3440.106
Safari: 11.1
npmPackages:
apollo-boost: ^0.1.4 => 0.1.10
apollo-cache-inmemory: ^1.1.0 => 1.2.5
apollo-client: ^2.0.3 => 2.3.5
apollo-link: ^1.0.3 => 1.2.2
apollo-link-http: ^1.2.0 => 1.5.4
react-apollo: ^2.1.1 => 2.1.9
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Reset store after logout with Apollo client - Stack Overflow
Remove all data from the store. Unlike resetStore, clearStore will not refetch any active queries. Share.
Read more >Advanced topics on caching in Apollo Client
To reset the cache without refetching active queries, use client.clearStore() instead of client.resetStore() . Responding to cache resets. You can register ...
Read more >[Solved]-Reset store after logout with Apollo client-Reactjs
Unlike resetStore, clearStore will not refetch any active queries. JSON C11 10147. score:12. you can use useApolloClient to access apollo client.
Read more >Optimizing React Native offline mode using Apollo Cache ...
While all of this effectively works, you can quickly see how this can become difficult to maintain for larger apps. Apollo Client. With...
Read more >Advanced Topics on Caching – Angular
Cache redirects using field policy read functions. ⚠️. Note: Apollo Client >= 3.0 no longer supports the ApolloClient cacheRedirects ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Amandeepsinghghai is correct - they haven’t been deployed yet. I’m pushing a new Apollo Client version right now, so 2.4.2 will be available in a few minutes with these changes. Thanks!
@zplawecki it looks like you’re attempting to call
resetStore
on the cache.resetStore
is anApolloClient
method, not an Apollo Cache method.