diff --git a/docs/framework/solid/reference/functions/useMutation.md b/docs/framework/solid/reference/functions/useMutation.md index 60455bbc1f..e70d9b9909 100644 --- a/docs/framework/solid/reference/functions/useMutation.md +++ b/docs/framework/solid/reference/functions/useMutation.md @@ -9,7 +9,10 @@ redirect_from: function useMutation(options: UseMutationOptions, queryClient?: Accessor): UseMutationResult; ``` -Defined in: [packages/solid-query/src/useMutation.ts:173](https://github.com/TanStack/query/blob/main/packages/solid-query/src/useMutation.ts#L173) +Defined in: [packages/solid-query/src/useMutation.ts:176](https://github.com/TanStack/query/blob/main/packages/solid-query/src/useMutation.ts#L176) + +Unlike queries, mutations are typically used to create/update/delete data or perform server side-effects. +`useMutation` is the function for that. ## Type Parameters diff --git a/docs/framework/solid/reference/functions/useQuery.md b/docs/framework/solid/reference/functions/useQuery.md index 82056ffaad..e102f8263d 100644 --- a/docs/framework/solid/reference/functions/useQuery.md +++ b/docs/framework/solid/reference/functions/useQuery.md @@ -11,7 +11,10 @@ redirect_from: function useQuery(options: UndefinedInitialDataOptions, queryClient?: () => QueryClient): UseQueryResult; ``` -Defined in: [packages/solid-query/src/useQuery.ts:178](https://github.com/TanStack/query/blob/main/packages/solid-query/src/useQuery.ts#L178) +Defined in: [packages/solid-query/src/useQuery.ts:181](https://github.com/TanStack/query/blob/main/packages/solid-query/src/useQuery.ts#L181) + +Subscribes to a query: a declarative dependency on an asynchronous source of data that is tied to a unique key. +The query runs when the options call for it — `enabled: false` skips the initial fetch. ### Type Parameters @@ -212,7 +215,10 @@ function Posts() { function useQuery(options: DefinedInitialDataOptions, queryClient?: () => QueryClient): DefinedUseQueryResult; ``` -Defined in: [packages/solid-query/src/useQuery.ts:226](https://github.com/TanStack/query/blob/main/packages/solid-query/src/useQuery.ts#L226) +Defined in: [packages/solid-query/src/useQuery.ts:232](https://github.com/TanStack/query/blob/main/packages/solid-query/src/useQuery.ts#L232) + +Subscribes to a query: a declarative dependency on an asynchronous source of data that is tied to a unique key. +The query runs when the options call for it — `enabled: false` skips the initial fetch. This overload is selected when `initialData` is set, so the resulting `data` is never `undefined`. diff --git a/docs/framework/solid/reference/variables/createMutation.md b/docs/framework/solid/reference/variables/createMutation.md index 0665cd3db1..3d435a9743 100644 --- a/docs/framework/solid/reference/variables/createMutation.md +++ b/docs/framework/solid/reference/variables/createMutation.md @@ -9,6 +9,9 @@ const createMutation: (options: UseM Defined in: [packages/solid-query/src/index.ts:80](https://github.com/TanStack/query/blob/main/packages/solid-query/src/index.ts#L80) +Unlike queries, mutations are typically used to create/update/delete data or perform server side-effects. +`useMutation` is the function for that. + ## Type Parameters ### TData diff --git a/docs/framework/solid/reference/variables/createQuery.md b/docs/framework/solid/reference/variables/createQuery.md index abb92c8444..ab8c83ce07 100644 --- a/docs/framework/solid/reference/variables/createQuery.md +++ b/docs/framework/solid/reference/variables/createQuery.md @@ -18,6 +18,9 @@ Defined in: [packages/solid-query/src/index.ts:57](https://github.com/TanStack/q (options: UndefinedInitialDataOptions, queryClient?: () => QueryClient): UseQueryResult; ``` +Subscribes to a query: a declarative dependency on an asynchronous source of data that is tied to a unique key. +The query runs when the options call for it — `enabled: false` skips the initial fetch. + ### Type Parameters #### TQueryFnData @@ -217,6 +220,9 @@ function Posts() { (options: DefinedInitialDataOptions, queryClient?: () => QueryClient): DefinedUseQueryResult; ``` +Subscribes to a query: a declarative dependency on an asynchronous source of data that is tied to a unique key. +The query runs when the options call for it — `enabled: false` skips the initial fetch. + This overload is selected when `initialData` is set, so the resulting `data` is never `undefined`. ### Type Parameters diff --git a/packages/solid-query/src/useMutation.ts b/packages/solid-query/src/useMutation.ts index 741176e25c..efd56d317d 100644 --- a/packages/solid-query/src/useMutation.ts +++ b/packages/solid-query/src/useMutation.ts @@ -12,6 +12,9 @@ import type { import type { Accessor } from 'solid-js' /** + * Unlike queries, mutations are typically used to create/update/delete data or perform server side-effects. + * `useMutation` is the function for that. + * * @param options - An accessor returning the {@link UseMutationOptions} to use. * @param queryClient - An accessor for a custom `QueryClient`. Otherwise, the one from the nearest context * will be used. diff --git a/packages/solid-query/src/useQuery.ts b/packages/solid-query/src/useQuery.ts index e9e238d1c6..edfdb6a07e 100644 --- a/packages/solid-query/src/useQuery.ts +++ b/packages/solid-query/src/useQuery.ts @@ -15,6 +15,9 @@ import type { } from './queryOptions' /** + * Subscribes to a query: a declarative dependency on an asynchronous source of data that is tied to a unique key. + * The query runs when the options call for it — `enabled: false` skips the initial fetch. + * * @see {@link queryOptions} to share these options between `useQuery` and imperative APIs like `queryClient.query`. * @param options - An accessor returning the {@link UndefinedInitialDataOptions} to use — everything you can * pass to `useQuery`. @@ -186,6 +189,9 @@ export function useQuery< ): UseQueryResult /** + * Subscribes to a query: a declarative dependency on an asynchronous source of data that is tied to a unique key. + * The query runs when the options call for it — `enabled: false` skips the initial fetch. + * * This overload is selected when `initialData` is set, so the resulting `data` is never `undefined`. * * @see {@link queryOptions} to share these options between `useQuery` and imperative APIs like `queryClient.query`.