question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

client.clearStore is not a function?? How?

See original GitHub issue

First, 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

screen shot 2018-09-11 at 1 15 51 pm

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:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
hwillsoncommented, Sep 12, 2018

@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!

1reaction
hwillsoncommented, Feb 19, 2019

@zplawecki it looks like you’re attempting to call resetStore on the cache. resetStore is an ApolloClient method, not an Apollo Cache method.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found