-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Make client.{reset,clear}Store
pass appropriate discardWatches
option to cache.reset
#8873
Make client.{reset,clear}Store
pass appropriate discardWatches
option to cache.reset
#8873
Conversation
return this.cache.reset(); | ||
} | ||
|
||
public resetStore(): Promise<ApolloQueryResult<any>[]> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The QueryManager#resetStore
method is no longer needed, because ApolloClient#resetStore
actually just calls client.queryManager.clearStore
, and QueryManager
is a private API.
export function resetStore(qm: QueryManager<any>) { | ||
return qm.clearStore({ | ||
discardWatches: false, | ||
}).then(() => qm.reFetchObservableQueries()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This helper function allows us to preserve existing tests that called qm.resetStore()
(now removed).
Thanks for responding so quickly to my discussion #8872, @benjamn. In looking at these changes, it appears to me that If this PR is merged, both As a consumer of I may be way off base on all of that, but I guess my recommendation is that this PR include documentation updates that clearly differentiate the appropriate use cases for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me @benjamn - thanks!
Follow-up to PR #8852, inspired by this discussion: #8872
e80dd03
to
3f07d95
Compare
The initial code changes from this commit are now available in While I agree the docs could take a stronger stance on which method ( My intuition is that |
Follow-up to PR #8852, inspired by discussion #8872 started by @KeithGillette. Depending on the discussion, we may need to make additional changes to align the various store-resetting/clearing operations, so I've left this PR as a draft for now.