@@ -5,6 +5,7 @@ import type {
55 AdditionalQueryHookOptions ,
66 Updater ,
77} from './types'
8+ import { isUndefined } from './utils'
89
910interface CreateQueryOptions
1011 extends Omit < UseBaseQueryOptions , 'queryKey' | 'queryFn' | 'enabled' > ,
@@ -34,10 +35,10 @@ export function createBaseQuery(
3435 const getPrimaryKey = ( ) => primaryKey
3536
3637 const getKey = ( variables ?: any ) =>
37- typeof variables === 'undefined' ? [ primaryKey ] : [ primaryKey , variables ]
38+ isUndefined ( variables ) ? [ primaryKey ] : [ primaryKey , variables ]
3839
3940 const useGeneratedQuery = ( {
40- variables,
41+ variables : currVariables ,
4142 ...currOptions
4243 } : QueryBaseHookOptions = { } ) => {
4344 const {
@@ -49,7 +50,9 @@ export function createBaseQuery(
4950 ...useDefaultOptions ?.( ) ,
5051 } as QueryBaseHookOptions
5152
52- const queryKey = getKey ( variables ?? prevVariables )
53+ const variables = isUndefined ( currVariables ) ? prevVariables : currVariables
54+
55+ const queryKey = getKey ( variables )
5356
5457 const { enabled, ...mergedOptions } = {
5558 ...prevOptions ,
0 commit comments