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

fetchPolicy config not working for queries #467

Closed
widmerin opened this issue Jan 6, 2023 · 3 comments · Fixed by #597
Closed

fetchPolicy config not working for queries #467

widmerin opened this issue Jan 6, 2023 · 3 comments · Fixed by #597
Labels

Comments

@widmerin
Copy link

widmerin commented Jan 6, 2023

Environment



Describe the bug

I tried to change the fetch policy for apollo in the nuxt.config.ts to cache-first

    defaultOptions: {
      query: {
        fetchPolicy: 'cache-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 [email protected] and @nuxtjs/[email protected]
Nuxt config:

 apollo: {
    defaultOptions: {
      query: {
        fetchPolicy: 'cache-first',
      },
    },
  ...
}

Query

const { data } = await useAsyncQuery(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

@widmerin widmerin added the bug label Jan 6, 2023
@keithmifsud
Copy link

  • 1 Same issue and cannot see the Apollo dev tools either.

@ssyberg
Copy link

ssyberg commented Nov 16, 2023

I'm oddly having the opposite problem and no-cache is not respected and always hits the cache

@ssyberg
Copy link

ssyberg commented Nov 16, 2023

Just want to add I'm seeing this generally work for useQuery but not at all for useAsyncQuery

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants