Intended outcome:
I am trying out the new evict and gc methods introduced in Apollo Client 3, as described in the docs Garbage collection and cache eviction docs.
Based on the docs, I expected to see both gc and evict as available methods on the ApolloCache object.
Actual outcome:
The TypeScript definitions for ApolloCache seem to be missing the gc method. This means that I can't see the gc method in intellisense or use the method without workarounds (such as casting cache to type any).
How to reproduce the issue:
In my React component, I grabbed a reference to the cache like so:
const { cache } = useApolloClient();
This returns me an ApolloCache object. I see evict in the list of available methods, but not gc.
Versions
System:
OS: macOS 10.15.2
Binaries:
Node: 12.13.1 - /usr/local/bin/node
Yarn: 1.22.0 - /usr/local/bin/yarn
npm: 6.13.7 - /usr/local/bin/npm
Browsers:
Chrome: 80.0.3987.116
Safari: 13.0.4
npmPackages:
@apollo/client: ^3.0.0-beta.36 => 3.0.0-beta.36
@apollo/link-context: ^2.0.0-beta.3 => 2.0.0-beta.3
@hwillson This seems like a quick follow-up to #5956? The default implementation of ApolloCache#gc can just return [], and InMemoryCache will override it with the real implementation.
@benjamn like dis? #5974
Not trying to be impatient, just figured this was a simple thing :D
Implemented in https://github.com/apollographql/apollo-client/pull/5974 - thanks @justinwaite!
Most helpful comment
@benjamn like dis? #5974
Not trying to be impatient, just figured this was a simple thing :D