Skip to content

Commit

Permalink
fix: ensure useAsyncQuery aheres to it's apollo client's `fetchPoli…
Browse files Browse the repository at this point in the history
…cy`, allowing `cache-first` override via the `cache` flag.
  • Loading branch information
Diizzayy committed Mar 1, 2024
1 parent 936153a commit 575c1d9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/runtime/composables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const prep = <T> (...args: any[]) => {
let query: TQuery<T>
let variables: TVariables<T>

let cache: boolean = true
let cache: boolean
let clientId: ApolloClientKeys | undefined
let context: DefaultContext

Expand All @@ -79,7 +79,7 @@ const prep = <T> (...args: any[]) => {
query = args?.[0]?.query
variables = args?.[0]?.variables

cache = args?.[0]?.cache ?? true
cache = args?.[0]?.cache
context = args?.[0]?.context
clientId = args?.[0]?.clientId

Expand Down Expand Up @@ -118,7 +118,7 @@ const prep = <T> (...args: any[]) => {
const fn = () => clients![clientId!]?.query<T>({
query,
variables: variables || undefined,
fetchPolicy: cache ? 'cache-first' : 'no-cache',
...(cache && { fetchPolicy: 'cache-first' }),
context
}).then(r => r.data)

Expand Down

1 comment on commit 575c1d9

@Stanislavsonder
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! Does this commit can break the overriding of the cache policy? Because now, after the alpha12 version, I'm unable to override the query caching policy at all. Regarding the code I can see that 'cache: false' does not affect the query now. @Diizzayy
image

Please sign in to comment.