Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gc function missing from TypeScript definitions for ApolloCache (3.0.0-beta.36) #5966

Closed
mattwilson1024 opened this issue Feb 19, 2020 · 3 comments

Comments

@mattwilson1024
Copy link

mattwilson1024 commented Feb 19, 2020

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
@mattwilson1024 mattwilson1024 changed the title gc function missing from TypeScript definitions for ApolloCache ]3.0.0-beta.36 gc function missing from TypeScript definitions for ApolloCache (3.0.0-beta.36) Feb 19, 2020
@benjamn benjamn added this to the Release 3.0 milestone Feb 19, 2020
@benjamn
Copy link
Member

benjamn commented Feb 19, 2020

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

@justinwaite
Copy link
Contributor

justinwaite commented Feb 20, 2020

@benjamn like dis? #5974

Not trying to be impatient, just figured this was a simple thing :D

hwillson added a commit that referenced this issue Feb 21, 2020
* Add default implementation of ApolloCache#gc

Addresses #5966

* Changelog update

Co-authored-by: Hugh Willson <hugh@octonary.com>
@hwillson
Copy link
Member

Implemented in #5974 - thanks @justinwaite!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants