@@ -808,20 +808,26 @@ export type OptionalRestArgsOrSkip<FuncRef extends FunctionReference<any>> =
808808 *
809809 * @public
810810 */
811- export type UseQueryOptions < Query extends FunctionReference < "query" > > =
812- QueryOptions < Query > & {
813- /**
814- * Whether to throw an error if the query fails.
815- * If false, the error will be returned in the `error` field.
816- * @defaultValue false
817- */
818- throwOnError ?: boolean ;
819- /**
820- * An initial value to use before the query result is available.
821- * @defaultValue undefined
822- */
823- initialValue ?: Query [ "_returnType" ] ;
824- } ;
811+ export type UseQueryOptions < Query extends FunctionReference < "query" > > = (
812+ | ( QueryOptions < Query > & { skip ?: false } )
813+ | {
814+ query : Query ;
815+ args ?: NoInfer < unknown > ;
816+ skip : true ;
817+ }
818+ ) & {
819+ /**
820+ * Whether to throw an error if the query fails.
821+ * If false, the error will be returned in the `error` field.
822+ * @defaultValue false
823+ */
824+ throwOnError ?: boolean ;
825+ /**
826+ * An initial value to use before the query result is available.
827+ * @defaultValue undefined
828+ */
829+ initialValue ?: Query [ "_returnType" ] ;
830+ } ;
825831
826832/**
827833 * Options for the object-based {@link useQuery} overload with a preloaded query.
@@ -941,7 +947,9 @@ export function useQuery<Query extends FunctionReference<"query">>(
941947 typeof query === "string"
942948 ? ( makeFunctionReference < "query" , any , any > ( query ) as Query )
943949 : query ;
944- argsObject = queryOrOptions . args ?? ( { } as Record < string , Value > ) ;
950+ if ( ! queryOrOptions . skip && queryOrOptions . args ) {
951+ argsObject = queryOrOptions . args ;
952+ }
945953 throwOnError = queryOrOptions . throwOnError ?? false ;
946954 initialValue = queryOrOptions . initialValue ;
947955 }
0 commit comments