Closed widmerin closed 4 months ago
Darwin
v16.18.0
3.0.0
1.0.0
npm@8.19.2
vite
runtimeConfig
css
components
build
modules
proxy
serverMiddleware
apollo
alias
@nuxtjs/color-mode@3.2.0
nuxt-proxy@0.3.4
@formkit/nuxt@1.0.0-beta.12
@pinia/nuxt@0.4.6
@nuxtjs/i18n@8.0.0-beta.7
@nuxtjs/apollo@5.0.0-alpha.5
-
I tried to change the fetch policy for apollo in the nuxt.config.ts tocache-first
nuxt.config.ts
cache-first
defaultOptions: { query: { fetchPolicy: 'cache-first', }, ... }
This setting has no effect on the queries, which are always executed with no-cache
no-cache
Queries should use fetch Policy from defaultOptions.
I use nuxt@3.0.0 and @nuxtjs/apollo@5.0.0-alpha.5 Nuxt config:
nuxt@3.0.0
apollo: { defaultOptions: { query: { fetchPolicy: 'cache-first', }, }, ... }
Query
const { data } = await useAsyncQuery(query)
In the https://github.com/nuxt-modules/apollo/blob/v5/src/runtime/composables.ts#L51 the queries get set to no-cache, how can I overwrite this? Is there a way that I can use apollo cache for queries?
No response
I'm oddly having the opposite problem and no-cache is not respected and always hits the cache
Just want to add I'm seeing this generally work for useQuery but not at all for useAsyncQuery
useQuery
useAsyncQuery
Environment
Darwin
v16.18.0
3.0.0
1.0.0
npm@8.19.2
vite
runtimeConfig
,css
,vite
,components
,build
,modules
,proxy
,serverMiddleware
,apollo
,alias
@nuxtjs/color-mode@3.2.0
,nuxt-proxy@0.3.4
,@formkit/nuxt@1.0.0-beta.12
,@pinia/nuxt@0.4.6
,@nuxtjs/i18n@8.0.0-beta.7
,@nuxtjs/apollo@5.0.0-alpha.5
Build Modules:
-
Describe the bug
I tried to change the fetch policy for apollo in the
nuxt.config.ts
tocache-first
This setting has no effect on the queries, which are always executed with
no-cache
Expected behaviour
Queries should use fetch Policy from defaultOptions.
Reproduction
I use
nuxt@3.0.0
and@nuxtjs/apollo@5.0.0-alpha.5
Nuxt config:Query
Additional context
In the https://github.com/nuxt-modules/apollo/blob/v5/src/runtime/composables.ts#L51 the queries get set to
no-cache
, how can I overwrite this? Is there a way that I can use apollo cache for queries?Logs
No response