@@ -3,7 +3,7 @@ import { print } from 'graphql'
3
3
import type { ApolloClient , OperationVariables , QueryOptions , DefaultContext } from '@apollo/client'
4
4
import type { AsyncData , AsyncDataOptions , NuxtError , NuxtApp } from 'nuxt/app'
5
5
import type { RestartableClient } from './ws'
6
- import { ref , isRef , reactive , useCookie , useNuxtApp , useAsyncData } from '#imports'
6
+ import { ref , unref , isRef , reactive , useCookie , useNuxtApp , useAsyncData } from '#imports'
7
7
import { NuxtApollo } from '#apollo'
8
8
import type { ApolloClientKeys } from '#apollo'
9
9
@@ -163,11 +163,11 @@ const prep = <T> (...args: any[]) => {
163
163
options . watch . push ( variables )
164
164
}
165
165
166
- const key : string = args ?. [ 0 ] ?. key || hash ( { query : print ( query ) , variables, clientId } )
166
+ const key : string = args ?. [ 0 ] ?. key || hash ( { query : print ( query ) , unref ( variables ) , clientId } )
167
167
168
168
const fn = ( ) => clients ! [ clientId ! ] ?. query < T > ( {
169
169
query,
170
- variables : variables || undefined ,
170
+ variables : unref ( variables ) || undefined ,
171
171
...( cache && { fetchPolicy : 'cache-first' } ) ,
172
172
context
173
173
} ) . then ( r => r . data )
0 commit comments