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

Don't read from cache when fetchPolicy = 'no-cache' #32

Open
onethread opened this issue Jul 30, 2018 · 0 comments
Open

Don't read from cache when fetchPolicy = 'no-cache' #32

onethread opened this issue Jul 30, 2018 · 0 comments
Labels
📕 cache Feature requests related to the cache project-apollo-client (legacy) LEGACY TAG DO NOT USE

Comments

@onethread
Copy link

onethread commented Jul 30, 2018

Migrated from: apollographql/apollo-client#3396:

I have a lot of large read-only queries that I am using fetchPolicy='no-cache', but through the vue-apollo bindings the getCurrentQueryResult function is used in certain contexts that do a lot of unnecessary work / exceptions being thrown and caught that show up in my profiling analysis.

At this line, it should be safe to no execute this.dataStore.getCache().read(...) if observableQuery.options.fetchPolicy = 'no-cache' since our store will never contain this query.

Probably short-circuiting the function and returning: return maybeDeepFreeze({ data: {}, partial: true }); would be best.

https://github.com/apollographql/apollo-client/blob/9ac90e0c1729d11a41663c9a7032200369f3305d/packages/apollo-client/src/core/QueryManager.ts#L976

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📕 cache Feature requests related to the cache project-apollo-client (legacy) LEGACY TAG DO NOT USE
Projects
None yet
Development

No branches or pull requests

3 participants