Open LuXDAmore opened 5 years ago
Can we test if this issue still exists?
@kieusonlam I think this is related https://github.com/nuxt-community/apollo-module/issues/273
I've seen clearing apollo cacahe app.apolloProvider.defaultClient.cache.data.clear()
in nuxtServerInit
, helps with this. @kieusonlam any idea about this?
Also, this issue seems there in the production, in development it's not there.
Hey @LuXDAmore, can you check this bug with https://github.com/nuxt-community/apollo-module/pull/274 PR?
I've made this comment in the review (after it was merged though):
Wouldn't it be better to configure InMemoryCache to not cache in the first place?
Author of the issue said:
I've tried to remove the cache in the default-config, but without success.
So I wonder what have you tried @LuXDAmore
@LuXDAmore I'm using configuration like this:
defaultOptions: {
query: {
fetchPolicy: 'no-cache',
errorPolicy: 'all',
},
},
and it works to disable cache. In you message you seem to use $query
instead of query
.
@rchl I've read about it here.. But yes, i've tried without too.. Maybe it's something related to the fact that it's in a middle-ware 🤷♂
Unfortunately, I can't reproduce the initial problem with your test repo (tried with yarn start
in production, on Node 10) so I can't test it out myself and see if I could make it work. Reloading page doesn't make response size to grow...
I think it's wasteful to let apollo cache stuff if it's cleared anyway.
I think changing fetchPolicy
won't help much as we need to use caching in case of process.client
.
Regarding, I think we're forcefully using InMemoryCache
even if that's not defined in apollo-config
.
I've tried to remove the cache in the default-config, but without success.
But plugin runs on both client and server and configuration for each can differ
Yes, we can do that manually, but I think that's not good idea. As it should be there in the package itself.
Version
v4.0.0-rc.12
Reproduction link
nuxt-apollo-middleware
Steps to reproduce
Install apollo-module for Nuxt; Use a query from 'apollo' in a middle-ware.
What is expected ?
The HTML doesn't not have to grow up on every navigation.
What is actually happening?
The HTML grow up since ~ 100 MB.
Additional comments?
Using
apollo.cache.data.clear();
before theapollo.query()
remove the issue. I've tried to remove the cache in the default-config, but without success.(In my project i need
in-cache-memory
because i have some Fragments, but unfortunately i don't have a valid example for that.)