@@ -649,20 +649,26 @@ export type OptionalRestArgsOrSkip<FuncRef extends FunctionReference<any>> =
649649 *
650650 * @public
651651 */
652- export type UseQueryOptions < Query extends FunctionReference < "query" > > =
653- QueryOptions < Query > & {
654- /**
655- * Whether to throw an error if the query fails.
656- * If false, the error will be returned in the `error` field.
657- * @defaultValue false
658- */
659- throwOnError ?: boolean ;
660- /**
661- * An initial value to use before the query result is available.
662- * @defaultValue undefined
663- */
664- initialValue ?: Query [ "_returnType" ] ;
665- } ;
652+ export type UseQueryOptions < Query extends FunctionReference < "query" > > = (
653+ | ( QueryOptions < Query > & { skip ?: false } )
654+ | {
655+ query : Query ;
656+ args ?: NoInfer < unknown > ;
657+ skip : true ;
658+ }
659+ ) & {
660+ /**
661+ * Whether to throw an error if the query fails.
662+ * If false, the error will be returned in the `error` field.
663+ * @defaultValue false
664+ */
665+ throwOnError ?: boolean ;
666+ /**
667+ * An initial value to use before the query result is available.
668+ * @defaultValue undefined
669+ */
670+ initialValue ?: Query [ "_returnType" ] ;
671+ } ;
666672
667673/**
668674 * Options for the object-based {@link useQuery} overload with a preloaded query.
@@ -782,7 +788,9 @@ export function useQuery<Query extends FunctionReference<"query">>(
782788 typeof query === "string"
783789 ? ( makeFunctionReference < "query" , any , any > ( query ) as Query )
784790 : query ;
785- argsObject = queryOrOptions . args ?? ( { } as Record < string , Value > ) ;
791+ if ( ! queryOrOptions . skip && queryOrOptions . args ) {
792+ argsObject = queryOrOptions . args ;
793+ }
786794 throwOnError = queryOrOptions . throwOnError ?? false ;
787795 initialValue = queryOrOptions . initialValue ;
788796 }
0 commit comments