diff --git a/docs/framework/angular/reference/functions/experimental_streamedQuery.md b/docs/framework/angular/reference/functions/experimental_streamedQuery.md index 38ca68beefc..0ab1af0aa52 100644 --- a/docs/framework/angular/reference/functions/experimental_streamedQuery.md +++ b/docs/framework/angular/reference/functions/experimental_streamedQuery.md @@ -6,7 +6,14 @@ title: experimental_streamedQuery ```ts -function experimental_streamedQuery(options: StreamedQueryParams): (context: object) => TData | Promise; +function experimental_streamedQuery(options: StreamedQueryParams): (context: { + client: QueryClient; + direction?: unknown; + meta: Record | undefined; + pageParam?: unknown; + queryKey: TQueryKey; + signal: AbortSignal; +}) => TData | Promise; ``` Defined in: [packages/query-core/src/streamedQuery.ts:70](https://github.com/TanStack/query/blob/main/packages/query-core/src/streamedQuery.ts#L70) @@ -43,7 +50,14 @@ The `streamFn` that returns an AsyncIterable to stream data from, and the option A query function to pass as `queryFn`. -(`context`: `object`) => `TData` \| `Promise`\<`TData`\> +(`context`: \{ + `client`: [`QueryClient`](../classes/QueryClient.md); + `direction?`: `unknown`; + `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; + `pageParam?`: `unknown`; + `queryKey`: `TQueryKey`; + `signal`: `AbortSignal`; +\}) => `TData` \| `Promise`\<`TData`\> ## Example diff --git a/docs/framework/angular/reference/functions/hydrate.md b/docs/framework/angular/reference/functions/hydrate.md index 411978a70f8..aa8ca8ffd6e 100644 --- a/docs/framework/angular/reference/functions/hydrate.md +++ b/docs/framework/angular/reference/functions/hydrate.md @@ -56,7 +56,7 @@ client's `defaultOptions.hydrate`), and `deserializeData` to reverse `serializeD | Property | Type | Description | | ------ | ------ | ------ | -| `defaultOptions?` | `object` | Options applied to the queries and mutations restored from the dehydrated state. | +| `defaultOptions?` | \{ `deserializeData?`: `TransformerFn`; `mutations?`: [`MutationOptions`](../interfaces/MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: [`QueryOptions`](../interfaces/QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \} | Options applied to the queries and mutations restored from the dehydrated state. | | `defaultOptions.deserializeData?` | `TransformerFn` | Transforms a query's `data` after it is read from the dehydrated state, reversing `serializeData`. | | `defaultOptions.mutations?` | [`MutationOptions`](../interfaces/MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\> | Default options merged into every mutation restored from the dehydrated state. | | `defaultOptions.queries?` | [`QueryOptions`](../interfaces/QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\> | Default options merged into every query restored from the dehydrated state. | diff --git a/docs/framework/angular/reference/functions/injectInfiniteQuery.md b/docs/framework/angular/reference/functions/injectInfiniteQuery.md index a275a845f22..79a12f8fadd 100644 --- a/docs/framework/angular/reference/functions/injectInfiniteQuery.md +++ b/docs/framework/angular/reference/functions/injectInfiniteQuery.md @@ -399,11 +399,11 @@ Angular, this function runs in the reactive context, so signals read inside it d | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| ((`previousData`: \| [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<[`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TError`, [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\> \| `undefined`) => \| [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/angular/reference/functions/injectQuery.md b/docs/framework/angular/reference/functions/injectQuery.md index e92d62b8050..4bbe52b95ba 100644 --- a/docs/framework/angular/reference/functions/injectQuery.md +++ b/docs/framework/angular/reference/functions/injectQuery.md @@ -310,11 +310,11 @@ the query. | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| `NonFunctionGuard`\<`TQueryFnData`\> \| ((`previousData`: `NonFunctionGuard`\<`TQueryFnData`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<`NonFunctionGuard`\<`TQueryFnData`\>, `TError`, `NonFunctionGuard`\<`TQueryFnData`\>, `TQueryKey`\> \| `undefined`) => `NonFunctionGuard`\<`TQueryFnData`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | -| `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | +| `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `TQueryKey`; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, `TQueryFnData`, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/angular/reference/functions/injectQueryClient.md b/docs/framework/angular/reference/functions/injectQueryClient.md index 92e5c6bf136..f76b5eb12ce 100644 --- a/docs/framework/angular/reference/functions/injectQueryClient.md +++ b/docs/framework/angular/reference/functions/injectQueryClient.md @@ -6,7 +6,9 @@ title: injectQueryClient ```ts -function injectQueryClient(injectOptions?: InjectOptions & object): QueryClient; +function injectQueryClient(injectOptions?: InjectOptions & { + injector?: Injector; +}): QueryClient; ``` Defined in: [packages/angular-query-experimental/src/inject-query-client.ts:18](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-query-client.ts#L18) @@ -17,7 +19,9 @@ Injects a `QueryClient` instance and allows passing a custom injector. ### injectOptions? -`InjectOptions` & `object` = `{}` +`InjectOptions` & \{ + `injector?`: `Injector`; +\} = `{}` Type of the options argument to inject and optionally a custom injector. diff --git a/docs/framework/angular/reference/interfaces/CreateBaseQueryOptions.md b/docs/framework/angular/reference/interfaces/CreateBaseQueryOptions.md index 2f4c9f4fa8b..1ccb2570b6a 100644 --- a/docs/framework/angular/reference/interfaces/CreateBaseQueryOptions.md +++ b/docs/framework/angular/reference/interfaces/CreateBaseQueryOptions.md @@ -61,11 +61,11 @@ The type of your `queryKey`. | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| `NonFunctionGuard`\<`TQueryData`\> \| ((`previousData`: `NonFunctionGuard`\<`TQueryData`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<`NonFunctionGuard`\<`TQueryData`\>, `TError`, `NonFunctionGuard`\<`TQueryData`\>, `TQueryKey`\> \| `undefined`) => `NonFunctionGuard`\<`TQueryData`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | -| `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | +| `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `TQueryKey`; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, `TQueryData`, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/angular/reference/interfaces/CreateInfiniteQueryOptions.md b/docs/framework/angular/reference/interfaces/CreateInfiniteQueryOptions.md index ade6e903b34..83a2350d800 100644 --- a/docs/framework/angular/reference/interfaces/CreateInfiniteQueryOptions.md +++ b/docs/framework/angular/reference/interfaces/CreateInfiniteQueryOptions.md @@ -65,11 +65,11 @@ The type of the parameter passed to `queryFn` to fetch a given page. | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| ((`previousData`: \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<[`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TError`, [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\> \| `undefined`) => \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/angular/reference/interfaces/CreateQueryOptions.md b/docs/framework/angular/reference/interfaces/CreateQueryOptions.md index 13dd257ec9c..68e1542456e 100644 --- a/docs/framework/angular/reference/interfaces/CreateQueryOptions.md +++ b/docs/framework/angular/reference/interfaces/CreateQueryOptions.md @@ -53,11 +53,11 @@ The type of your `queryKey`. | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| `NonFunctionGuard`\<`TQueryFnData`\> \| ((`previousData`: `NonFunctionGuard`\<`TQueryFnData`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<`NonFunctionGuard`\<`TQueryFnData`\>, `TError`, `NonFunctionGuard`\<`TQueryFnData`\>, `TQueryKey`\> \| `undefined`) => `NonFunctionGuard`\<`TQueryFnData`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | -| `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | +| `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `TQueryKey`; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, `TQueryFnData`, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/angular/reference/interfaces/DefaultOptions.md b/docs/framework/angular/reference/interfaces/DefaultOptions.md index 25628a573fb..f26d4b5519c 100644 --- a/docs/framework/angular/reference/interfaces/DefaultOptions.md +++ b/docs/framework/angular/reference/interfaces/DefaultOptions.md @@ -21,7 +21,7 @@ The default options of a `QueryClient`, applied to every query (`queries`), muta | Property | Type | Description | | ------ | ------ | ------ | | `dehydrate?` | [`DehydrateOptions`](DehydrateOptions.md) | Default options used when dehydrating the client's caches; see [DehydrateOptions](DehydrateOptions.md). | -| `hydrate?` | `object` | Default options used when hydrating queries and mutations; see [HydrateOptions](HydrateOptions.md). | +| `hydrate?` | \{ `deserializeData?`: `TransformerFn`; `mutations?`: [`MutationOptions`](MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: [`QueryOptions`](QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \} | Default options used when hydrating queries and mutations; see [HydrateOptions](HydrateOptions.md). | | `hydrate.deserializeData?` | `TransformerFn` | Transforms a query's `data` after it is read from the dehydrated state, reversing `serializeData`. | | `hydrate.mutations?` | [`MutationOptions`](MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\> | Default options merged into every mutation restored from the dehydrated state. | | `hydrate.queries?` | [`QueryOptions`](QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\> | Default options merged into every query restored from the dehydrated state. | diff --git a/docs/framework/angular/reference/interfaces/EnsureQueryDataOptions.md b/docs/framework/angular/reference/interfaces/EnsureQueryDataOptions.md index 489415d5d37..8ab6c8bf8b8 100644 --- a/docs/framework/angular/reference/interfaces/EnsureQueryDataOptions.md +++ b/docs/framework/angular/reference/interfaces/EnsureQueryDataOptions.md @@ -46,10 +46,10 @@ Defined in: [packages/query-core/src/types.ts:774](https://github.com/TanStack/q | ~~`maxPages?`~~ | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | ~~`meta?`~~ | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | ~~`networkMode?`~~ | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | ~~`queryFn?`~~ | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | ~~`queryHash?`~~ | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| ~~`queryKey`~~ | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| ~~`queryKey`~~ | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | ~~`queryKeyHashFn?`~~ | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | ~~`retry?`~~ | \| `number` \| `false` \| `true` \| ((`failureCount`: `number`, `error`: `TError`) => `boolean`) | `undefined` | If `false`, failed queries will not retry by default. If `true`, failed queries will retry infinitely. If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number. If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false. Defaults to `3` on the client and `0` on the server. | | ~~`retryDelay?`~~ | `number` \| ((`failureCount`: `number`, `error`: `TError`) => `number`) | `undefined` | This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. A function like `attempt => attempt * 1000` applies linear backoff. Defaults to a function that applies exponential backoff, capped at 30 seconds. | diff --git a/docs/framework/angular/reference/interfaces/FetchQueryOptions.md b/docs/framework/angular/reference/interfaces/FetchQueryOptions.md index 5a288291ebd..d6fcdc3ef78 100644 --- a/docs/framework/angular/reference/interfaces/FetchQueryOptions.md +++ b/docs/framework/angular/reference/interfaces/FetchQueryOptions.md @@ -50,10 +50,10 @@ Defined in: [packages/query-core/src/types.ts:752](https://github.com/TanStack/q | ~~`maxPages?`~~ | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | ~~`meta?`~~ | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | ~~`networkMode?`~~ | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | ~~`queryFn?`~~ | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | ~~`queryHash?`~~ | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| ~~`queryKey`~~ | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| ~~`queryKey`~~ | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | ~~`queryKeyHashFn?`~~ | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | ~~`retry?`~~ | \| `number` \| `false` \| `true` \| ((`failureCount`: `number`, `error`: `TError`) => `boolean`) | `undefined` | If `false`, failed queries will not retry by default. If `true`, failed queries will retry infinitely. If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number. If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false. Defaults to `3` on the client and `0` on the server. | | ~~`retryDelay?`~~ | `number` \| ((`failureCount`: `number`, `error`: `TError`) => `number`) | `undefined` | This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. A function like `attempt => attempt * 1000` applies linear backoff. Defaults to a function that applies exponential backoff, capped at 30 seconds. | diff --git a/docs/framework/angular/reference/interfaces/HydrateOptions.md b/docs/framework/angular/reference/interfaces/HydrateOptions.md index f070f729ff9..1dd5de960ae 100644 --- a/docs/framework/angular/reference/interfaces/HydrateOptions.md +++ b/docs/framework/angular/reference/interfaces/HydrateOptions.md @@ -14,7 +14,7 @@ Options for `hydrate`, controlling the default options applied to queries/mutati | Property | Type | Description | | ------ | ------ | ------ | -| `defaultOptions?` | `object` | Options applied to the queries and mutations restored from the dehydrated state. | +| `defaultOptions?` | \{ `deserializeData?`: `TransformerFn`; `mutations?`: [`MutationOptions`](MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: [`QueryOptions`](QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \} | Options applied to the queries and mutations restored from the dehydrated state. | | `defaultOptions.deserializeData?` | `TransformerFn` | Transforms a query's `data` after it is read from the dehydrated state, reversing `serializeData`. | | `defaultOptions.mutations?` | [`MutationOptions`](MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\> | Default options merged into every mutation restored from the dehydrated state. | | `defaultOptions.queries?` | [`QueryOptions`](QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\> | Default options merged into every query restored from the dehydrated state. | diff --git a/docs/framework/angular/reference/interfaces/InfiniteQueryObserverOptions.md b/docs/framework/angular/reference/interfaces/InfiniteQueryObserverOptions.md index 418e3d41ebf..c8cbb098e8a 100644 --- a/docs/framework/angular/reference/interfaces/InfiniteQueryObserverOptions.md +++ b/docs/framework/angular/reference/interfaces/InfiniteQueryObserverOptions.md @@ -52,11 +52,11 @@ The options of an `InfiniteQueryObserver`: [QueryObserverOptions](QueryObserverO | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| ((`previousData`: \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<[`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TError`, [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\> \| `undefined`) => \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/angular/reference/interfaces/QueryExecuteOptions.md b/docs/framework/angular/reference/interfaces/QueryExecuteOptions.md index a14c79bfc19..0f472791f1e 100644 --- a/docs/framework/angular/reference/interfaces/QueryExecuteOptions.md +++ b/docs/framework/angular/reference/interfaces/QueryExecuteOptions.md @@ -52,10 +52,10 @@ transforms the value the call resolves with. | `maxPages?` | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `retry?` | \| `number` \| `false` \| `true` \| ((`failureCount`: `number`, `error`: `TError`) => `boolean`) | `undefined` | If `false`, failed queries will not retry by default. If `true`, failed queries will retry infinitely. If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number. If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false. Defaults to `3` on the client and `0` on the server. | | `retryDelay?` | `number` \| ((`failureCount`: `number`, `error`: `TError`) => `number`) | `undefined` | This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. A function like `attempt => attempt * 1000` applies linear backoff. Defaults to a function that applies exponential backoff, capped at 30 seconds. | diff --git a/docs/framework/angular/reference/interfaces/QueryObserverOptions.md b/docs/framework/angular/reference/interfaces/QueryObserverOptions.md index 6a34e6e05cd..763a67b70dc 100644 --- a/docs/framework/angular/reference/interfaces/QueryObserverOptions.md +++ b/docs/framework/angular/reference/interfaces/QueryObserverOptions.md @@ -58,11 +58,11 @@ The options of a `QueryObserver`, and of the hooks built on it like `useQuery`: | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| `NonFunctionGuard`\<`TQueryData`\> \| ((`previousData`: `NonFunctionGuard`\<`TQueryData`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<`NonFunctionGuard`\<`TQueryData`\>, `TError`, `NonFunctionGuard`\<`TQueryData`\>, `TQueryKey`\> \| `undefined`) => `NonFunctionGuard`\<`TQueryData`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, `TQueryData`, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/angular/reference/interfaces/QueryOptions.md b/docs/framework/angular/reference/interfaces/QueryOptions.md index 574f08b670a..72c9a70ab0e 100644 --- a/docs/framework/angular/reference/interfaces/QueryOptions.md +++ b/docs/framework/angular/reference/interfaces/QueryOptions.md @@ -42,7 +42,7 @@ The options of a query itself — its `queryKey`, `queryFn`, retries, `gcTime`, | `maxPages?` | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `queryFn?` | \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) \| *typeof* [`skipToken`](../variables/skipToken.md) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | | `queryKey?` | `TQueryKey` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | diff --git a/docs/framework/angular/reference/type-aliases/AnyDataTag.md b/docs/framework/angular/reference/type-aliases/AnyDataTag.md index 4b9304ed2ee..65d582ac8aa 100644 --- a/docs/framework/angular/reference/type-aliases/AnyDataTag.md +++ b/docs/framework/angular/reference/type-aliases/AnyDataTag.md @@ -6,7 +6,10 @@ title: AnyDataTag ```ts -type AnyDataTag = object; +type AnyDataTag = { + [dataTagErrorSymbol]: any; + [dataTagSymbol]: any; +}; ``` Defined in: [packages/query-core/src/types.ts:122](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L122) diff --git a/docs/framework/angular/reference/type-aliases/CreateBaseMutationResult.md b/docs/framework/angular/reference/type-aliases/CreateBaseMutationResult.md index a419ba0c03e..1de3955a32b 100644 --- a/docs/framework/angular/reference/type-aliases/CreateBaseMutationResult.md +++ b/docs/framework/angular/reference/type-aliases/CreateBaseMutationResult.md @@ -8,7 +8,9 @@ title: CreateBaseMutationResult ```ts type CreateBaseMutationResult = Override, { mutate: CreateMutateFunction; -}> & object; +}> & { + mutateAsync: CreateMutateAsyncFunction; +}; ``` Defined in: [packages/angular-query-experimental/src/types.ts:281](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/types.ts#L281) diff --git a/docs/framework/angular/reference/type-aliases/DataTag.md b/docs/framework/angular/reference/type-aliases/DataTag.md index 6e5cbfd46b9..22389c45a62 100644 --- a/docs/framework/angular/reference/type-aliases/DataTag.md +++ b/docs/framework/angular/reference/type-aliases/DataTag.md @@ -6,7 +6,10 @@ title: DataTag ```ts -type DataTag = TType extends AnyDataTag ? TType : TType & object; +type DataTag = TType extends AnyDataTag ? TType : TType & { + [dataTagErrorSymbol]: TError; + [dataTagSymbol]: TValue; +}; ``` Defined in: [packages/query-core/src/types.ts:137](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L137) diff --git a/docs/framework/angular/reference/type-aliases/DefaultError.md b/docs/framework/angular/reference/type-aliases/DefaultError.md index 85150115168..1db2fd40ed7 100644 --- a/docs/framework/angular/reference/type-aliases/DefaultError.md +++ b/docs/framework/angular/reference/type-aliases/DefaultError.md @@ -6,7 +6,9 @@ title: DefaultError ```ts -type DefaultError = Register extends object ? TError : Error; +type DefaultError = Register extends { + defaultError: infer TError; +} ? TError : Error; ``` Defined in: [packages/query-core/src/types.ts:83](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L83) diff --git a/docs/framework/angular/reference/type-aliases/DefinedInitialDataInfiniteOptions.md b/docs/framework/angular/reference/type-aliases/DefinedInitialDataInfiniteOptions.md index f27a2fb8daf..93ccd94d7ff 100644 --- a/docs/framework/angular/reference/type-aliases/DefinedInitialDataInfiniteOptions.md +++ b/docs/framework/angular/reference/type-aliases/DefinedInitialDataInfiniteOptions.md @@ -6,7 +6,11 @@ title: DefinedInitialDataInfiniteOptions ```ts -type DefinedInitialDataInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = CreateInfiniteQueryOptions & object; +type DefinedInitialDataInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = CreateInfiniteQueryOptions & { + initialData: | NonUndefinedGuard> + | (() => NonUndefinedGuard>) + | undefined; +}; ``` Defined in: [packages/angular-query-experimental/src/infinite-query-options.ts:106](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/infinite-query-options.ts#L106) diff --git a/docs/framework/angular/reference/type-aliases/DefinedInitialDataOptions.md b/docs/framework/angular/reference/type-aliases/DefinedInitialDataOptions.md index a8c6cacf82c..a012726e9cf 100644 --- a/docs/framework/angular/reference/type-aliases/DefinedInitialDataOptions.md +++ b/docs/framework/angular/reference/type-aliases/DefinedInitialDataOptions.md @@ -6,7 +6,11 @@ title: DefinedInitialDataOptions ```ts -type DefinedInitialDataOptions = Omit, "queryFn"> & object; +type DefinedInitialDataOptions = Omit, "queryFn"> & { + initialData: | NonUndefinedGuard + | (() => NonUndefinedGuard); + queryFn?: QueryFunction; +}; ``` Defined in: [packages/angular-query-experimental/src/query-options.ts:77](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/query-options.ts#L77) diff --git a/docs/framework/angular/reference/type-aliases/EnsureInfiniteQueryDataOptions.md b/docs/framework/angular/reference/type-aliases/EnsureInfiniteQueryDataOptions.md index 1142c9bf005..d9c876a6029 100644 --- a/docs/framework/angular/reference/type-aliases/EnsureInfiniteQueryDataOptions.md +++ b/docs/framework/angular/reference/type-aliases/EnsureInfiniteQueryDataOptions.md @@ -6,7 +6,9 @@ title: EnsureInfiniteQueryDataOptions ```ts -type EnsureInfiniteQueryDataOptions = FetchInfiniteQueryOptions & object; +type EnsureInfiniteQueryDataOptions = FetchInfiniteQueryOptions & { + revalidateIfStale?: boolean; +}; ``` Defined in: [packages/query-core/src/types.ts:794](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L794) diff --git a/docs/framework/angular/reference/type-aliases/MutationFunctionContext.md b/docs/framework/angular/reference/type-aliases/MutationFunctionContext.md index 39a5d19316a..4b2d040ca9a 100644 --- a/docs/framework/angular/reference/type-aliases/MutationFunctionContext.md +++ b/docs/framework/angular/reference/type-aliases/MutationFunctionContext.md @@ -6,7 +6,11 @@ title: MutationFunctionContext ```ts -type MutationFunctionContext = object; +type MutationFunctionContext = { + client: QueryClient; + meta: MutationMeta | undefined; + mutationKey?: MutationKey; +}; ``` Defined in: [packages/query-core/src/types.ts:1855](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1855) diff --git a/docs/framework/angular/reference/type-aliases/MutationKey.md b/docs/framework/angular/reference/type-aliases/MutationKey.md index 7c598833c16..372431c32fb 100644 --- a/docs/framework/angular/reference/type-aliases/MutationKey.md +++ b/docs/framework/angular/reference/type-aliases/MutationKey.md @@ -6,7 +6,9 @@ title: MutationKey ```ts -type MutationKey = Register extends object ? TMutationKey extends ReadonlyArray ? TMutationKey : TMutationKey extends unknown[] ? TMutationKey : ReadonlyArray : ReadonlyArray; +type MutationKey = Register extends { + mutationKey: infer TMutationKey; +} ? TMutationKey extends ReadonlyArray ? TMutationKey : TMutationKey extends unknown[] ? TMutationKey : ReadonlyArray : ReadonlyArray; ``` Defined in: [packages/query-core/src/types.ts:1814](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1814) diff --git a/docs/framework/angular/reference/type-aliases/MutationMeta.md b/docs/framework/angular/reference/type-aliases/MutationMeta.md index 2b7dc7446ae..ddac47dcfc4 100644 --- a/docs/framework/angular/reference/type-aliases/MutationMeta.md +++ b/docs/framework/angular/reference/type-aliases/MutationMeta.md @@ -6,7 +6,9 @@ title: MutationMeta ```ts -type MutationMeta = Register extends object ? TMutationMeta extends Record ? TMutationMeta : Record : Record; +type MutationMeta = Register extends { + mutationMeta: infer TMutationMeta; +} ? TMutationMeta extends Record ? TMutationMeta : Record : Record; ``` Defined in: [packages/query-core/src/types.ts:1843](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1843) diff --git a/docs/framework/angular/reference/type-aliases/MutationScope.md b/docs/framework/angular/reference/type-aliases/MutationScope.md index 4357b2d629d..f859dc913a9 100644 --- a/docs/framework/angular/reference/type-aliases/MutationScope.md +++ b/docs/framework/angular/reference/type-aliases/MutationScope.md @@ -6,7 +6,9 @@ title: MutationScope ```ts -type MutationScope = object; +type MutationScope = { + id: string; +}; ``` Defined in: [packages/query-core/src/types.ts:1832](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1832) diff --git a/docs/framework/angular/reference/type-aliases/QueryFunctionContext.md b/docs/framework/angular/reference/type-aliases/QueryFunctionContext.md index 15a8d2e9261..59324fb3aeb 100644 --- a/docs/framework/angular/reference/type-aliases/QueryFunctionContext.md +++ b/docs/framework/angular/reference/type-aliases/QueryFunctionContext.md @@ -6,7 +6,21 @@ title: QueryFunctionContext ```ts -type QueryFunctionContext = [TPageParam] extends [never] ? object : object; +type QueryFunctionContext = [TPageParam] extends [never] ? { + client: QueryClient; + direction?: unknown; + meta: QueryMeta | undefined; + pageParam?: unknown; + queryKey: TQueryKey; + signal: AbortSignal; +} : { + client: QueryClient; + direction: FetchDirection; + meta: QueryMeta | undefined; + pageParam: TPageParam; + queryKey: TQueryKey; + signal: AbortSignal; +}; ``` Defined in: [packages/query-core/src/types.ts:235](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L235) diff --git a/docs/framework/angular/reference/type-aliases/QueryKey.md b/docs/framework/angular/reference/type-aliases/QueryKey.md index 6a2c8ca5503..d358486f29b 100644 --- a/docs/framework/angular/reference/type-aliases/QueryKey.md +++ b/docs/framework/angular/reference/type-aliases/QueryKey.md @@ -6,7 +6,9 @@ title: QueryKey ```ts -type QueryKey = Register extends object ? TQueryKey extends ReadonlyArray ? TQueryKey : TQueryKey extends unknown[] ? TQueryKey : ReadonlyArray : ReadonlyArray; +type QueryKey = Register extends { + queryKey: infer TQueryKey; +} ? TQueryKey extends ReadonlyArray ? TQueryKey : TQueryKey extends unknown[] ? TQueryKey : ReadonlyArray : ReadonlyArray; ``` Defined in: [packages/query-core/src/types.ts:93](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L93) diff --git a/docs/framework/angular/reference/type-aliases/QueryKeyWithDataTag.md b/docs/framework/angular/reference/type-aliases/QueryKeyWithDataTag.md index 60244136ec1..f4c0ab86c9a 100644 --- a/docs/framework/angular/reference/type-aliases/QueryKeyWithDataTag.md +++ b/docs/framework/angular/reference/type-aliases/QueryKeyWithDataTag.md @@ -6,7 +6,9 @@ title: QueryKeyWithDataTag ```ts -type QueryKeyWithDataTag = object; +type QueryKeyWithDataTag = { + queryKey: DataTag; +}; ``` Defined in: [packages/query-core/src/types.ts:152](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L152) diff --git a/docs/framework/angular/reference/type-aliases/QueryMeta.md b/docs/framework/angular/reference/type-aliases/QueryMeta.md index 3df2e5a17bd..6f1b27a3d9e 100644 --- a/docs/framework/angular/reference/type-aliases/QueryMeta.md +++ b/docs/framework/angular/reference/type-aliases/QueryMeta.md @@ -6,7 +6,9 @@ title: QueryMeta ```ts -type QueryMeta = Register extends object ? TQueryMeta extends Record ? TQueryMeta : Record : Record; +type QueryMeta = Register extends { + queryMeta: infer TQueryMeta; +} ? TQueryMeta extends Record ? TQueryMeta : Record : Record; ``` Defined in: [packages/query-core/src/types.ts:330](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L330) diff --git a/docs/framework/angular/reference/type-aliases/TimeoutProvider.md b/docs/framework/angular/reference/type-aliases/TimeoutProvider.md index 6e3fd194540..88cd72aa7e3 100644 --- a/docs/framework/angular/reference/type-aliases/TimeoutProvider.md +++ b/docs/framework/angular/reference/type-aliases/TimeoutProvider.md @@ -6,7 +6,12 @@ title: TimeoutProvider ```ts -type TimeoutProvider = object; +type TimeoutProvider = { + clearInterval: (intervalId: TTimerId | undefined) => void; + clearTimeout: (timeoutId: TTimerId | undefined) => void; + setInterval: (callback: TimeoutCallback, delay: number) => TTimerId; + setTimeout: (callback: TimeoutCallback, delay: number) => TTimerId; +}; ``` Defined in: [packages/query-core/src/timeoutManager.ts:28](https://github.com/TanStack/query/blob/main/packages/query-core/src/timeoutManager.ts#L28) diff --git a/docs/framework/angular/reference/type-aliases/UndefinedInitialDataInfiniteOptions.md b/docs/framework/angular/reference/type-aliases/UndefinedInitialDataInfiniteOptions.md index 85fc4c15585..6495869657c 100644 --- a/docs/framework/angular/reference/type-aliases/UndefinedInitialDataInfiniteOptions.md +++ b/docs/framework/angular/reference/type-aliases/UndefinedInitialDataInfiniteOptions.md @@ -6,7 +6,10 @@ title: UndefinedInitialDataInfiniteOptions ```ts -type UndefinedInitialDataInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = CreateInfiniteQueryOptions & object; +type UndefinedInitialDataInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = CreateInfiniteQueryOptions & { + initialData?: | NonUndefinedGuard> + | InitialDataFunction>>; +}; ``` Defined in: [packages/angular-query-experimental/src/infinite-query-options.ts:23](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/infinite-query-options.ts#L23) diff --git a/docs/framework/angular/reference/type-aliases/UndefinedInitialDataOptions.md b/docs/framework/angular/reference/type-aliases/UndefinedInitialDataOptions.md index 11cbc607259..8f8b5a0fb79 100644 --- a/docs/framework/angular/reference/type-aliases/UndefinedInitialDataOptions.md +++ b/docs/framework/angular/reference/type-aliases/UndefinedInitialDataOptions.md @@ -6,7 +6,10 @@ title: UndefinedInitialDataOptions ```ts -type UndefinedInitialDataOptions = CreateQueryOptions & object; +type UndefinedInitialDataOptions = CreateQueryOptions & { + initialData?: | InitialDataFunction> + | NonUndefinedGuard; +}; ``` Defined in: [packages/angular-query-experimental/src/query-options.ts:21](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/query-options.ts#L21) diff --git a/docs/framework/angular/reference/type-aliases/UnusedSkipTokenInfiniteOptions.md b/docs/framework/angular/reference/type-aliases/UnusedSkipTokenInfiniteOptions.md index 3770815395b..6d9b6f5a344 100644 --- a/docs/framework/angular/reference/type-aliases/UnusedSkipTokenInfiniteOptions.md +++ b/docs/framework/angular/reference/type-aliases/UnusedSkipTokenInfiniteOptions.md @@ -6,7 +6,9 @@ title: UnusedSkipTokenInfiniteOptions ```ts -type UnusedSkipTokenInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = OmitKeyof, "queryFn"> & object; +type UnusedSkipTokenInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = OmitKeyof, "queryFn"> & { + queryFn?: Exclude["queryFn"], SkipToken | undefined>; +}; ``` Defined in: [packages/angular-query-experimental/src/infinite-query-options.ts:62](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/infinite-query-options.ts#L62) diff --git a/docs/framework/angular/reference/type-aliases/UnusedSkipTokenOptions.md b/docs/framework/angular/reference/type-aliases/UnusedSkipTokenOptions.md index e3a3989219f..d0efe3890d1 100644 --- a/docs/framework/angular/reference/type-aliases/UnusedSkipTokenOptions.md +++ b/docs/framework/angular/reference/type-aliases/UnusedSkipTokenOptions.md @@ -6,7 +6,9 @@ title: UnusedSkipTokenOptions ```ts -type UnusedSkipTokenOptions = OmitKeyof, "queryFn"> & object; +type UnusedSkipTokenOptions = OmitKeyof, "queryFn"> & { + queryFn?: Exclude["queryFn"], SkipToken | undefined>; +}; ``` Defined in: [packages/angular-query-experimental/src/query-options.ts:48](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/query-options.ts#L48) diff --git a/docs/framework/angular/reference/variables/environmentManager.md b/docs/framework/angular/reference/variables/environmentManager.md index 40b82d3a2de..4e8224270d3 100644 --- a/docs/framework/angular/reference/variables/environmentManager.md +++ b/docs/framework/angular/reference/variables/environmentManager.md @@ -6,7 +6,10 @@ title: environmentManager ```ts -const environmentManager: object; +const environmentManager: { + isServer: () => boolean; + setIsServer(isServerValue: IsServerValue): void; +}; ``` Defined in: [packages/query-core/src/environmentManager.ts:32](https://github.com/TanStack/query/blob/main/packages/query-core/src/environmentManager.ts#L32) diff --git a/docs/framework/angular/reference/variables/notifyManager.md b/docs/framework/angular/reference/variables/notifyManager.md index 82290f7f19a..5ddda37894d 100644 --- a/docs/framework/angular/reference/variables/notifyManager.md +++ b/docs/framework/angular/reference/variables/notifyManager.md @@ -6,7 +6,14 @@ title: notifyManager ```ts -const notifyManager: object; +const notifyManager: { + batch: (callback: () => T) => T; + batchCalls: (callback: BatchCallsCallback) => BatchCallsCallback; + schedule: (callback: NotifyCallback) => void; + setBatchNotifyFunction: (fn: BatchNotifyFunction) => void; + setNotifyFunction: (fn: NotifyFunction) => void; + setScheduler: (fn: ScheduleFunction) => void; +}; ``` Defined in: [packages/query-core/src/notifyManager.ts:154](https://github.com/TanStack/query/blob/main/packages/query-core/src/notifyManager.ts#L154) diff --git a/docs/framework/lit/reference/functions/experimental_streamedQuery.md b/docs/framework/lit/reference/functions/experimental_streamedQuery.md index 38ca68beefc..0ab1af0aa52 100644 --- a/docs/framework/lit/reference/functions/experimental_streamedQuery.md +++ b/docs/framework/lit/reference/functions/experimental_streamedQuery.md @@ -6,7 +6,14 @@ title: experimental_streamedQuery ```ts -function experimental_streamedQuery(options: StreamedQueryParams): (context: object) => TData | Promise; +function experimental_streamedQuery(options: StreamedQueryParams): (context: { + client: QueryClient; + direction?: unknown; + meta: Record | undefined; + pageParam?: unknown; + queryKey: TQueryKey; + signal: AbortSignal; +}) => TData | Promise; ``` Defined in: [packages/query-core/src/streamedQuery.ts:70](https://github.com/TanStack/query/blob/main/packages/query-core/src/streamedQuery.ts#L70) @@ -43,7 +50,14 @@ The `streamFn` that returns an AsyncIterable to stream data from, and the option A query function to pass as `queryFn`. -(`context`: `object`) => `TData` \| `Promise`\<`TData`\> +(`context`: \{ + `client`: [`QueryClient`](../classes/QueryClient.md); + `direction?`: `unknown`; + `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; + `pageParam?`: `unknown`; + `queryKey`: `TQueryKey`; + `signal`: `AbortSignal`; +\}) => `TData` \| `Promise`\<`TData`\> ## Example diff --git a/docs/framework/lit/reference/functions/hydrate.md b/docs/framework/lit/reference/functions/hydrate.md index 8c787dcf21e..206ee4bee93 100644 --- a/docs/framework/lit/reference/functions/hydrate.md +++ b/docs/framework/lit/reference/functions/hydrate.md @@ -56,7 +56,7 @@ client's `defaultOptions.hydrate`), and `deserializeData` to reverse `serializeD | Property | Type | Description | | ------ | ------ | ------ | -| `defaultOptions?` | `object` | Options applied to the queries and mutations restored from the dehydrated state. | +| `defaultOptions?` | \{ `deserializeData?`: `TransformerFn`; `mutations?`: [`MutationOptions`](../interfaces/MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: [`QueryOptions`](../interfaces/QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \} | Options applied to the queries and mutations restored from the dehydrated state. | | `defaultOptions.deserializeData?` | `TransformerFn` | Transforms a query's `data` after it is read from the dehydrated state, reversing `serializeData`. | | `defaultOptions.mutations?` | [`MutationOptions`](../interfaces/MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\> | Default options merged into every mutation restored from the dehydrated state. | | `defaultOptions.queries?` | [`QueryOptions`](../interfaces/QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\> | Default options merged into every query restored from the dehydrated state. | diff --git a/docs/framework/lit/reference/functions/infiniteQueryOptions.md b/docs/framework/lit/reference/functions/infiniteQueryOptions.md index 72788f431f5..77463f35fbc 100644 --- a/docs/framework/lit/reference/functions/infiniteQueryOptions.md +++ b/docs/framework/lit/reference/functions/infiniteQueryOptions.md @@ -6,7 +6,9 @@ title: infiniteQueryOptions ```ts -function infiniteQueryOptions, TQueryKey extends readonly unknown[] = readonly unknown[], TPageParam = unknown>(options: InfiniteQueryObserverOptions): InfiniteQueryObserverOptions & object; +function infiniteQueryOptions, TQueryKey extends readonly unknown[] = readonly unknown[], TPageParam = unknown>(options: InfiniteQueryObserverOptions): InfiniteQueryObserverOptions & { + queryKey: DataTag, TError>; +}; ``` Defined in: [packages/lit-query/src/infiniteQueryOptions.ts:26](https://github.com/TanStack/query/blob/main/packages/lit-query/src/infiniteQueryOptions.ts#L26) @@ -61,11 +63,11 @@ Infinite query options to preserve and brand. | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| ((`previousData`: \| [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<[`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TError`, [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\> \| `undefined`) => \| [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | @@ -83,7 +85,9 @@ Infinite query options to preserve and brand. ## Returns -[`InfiniteQueryObserverOptions`](../interfaces/InfiniteQueryObserverOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`, `TPageParam`\> & `object` +[`InfiniteQueryObserverOptions`](../interfaces/InfiniteQueryObserverOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`, `TPageParam`\> & \{ + `queryKey`: [`DataTag`](../type-aliases/DataTag.md)\<`TQueryKey`, [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`\>, `TError`\>; +\} The same options object with a typed `queryKey`. diff --git a/docs/framework/lit/reference/functions/queryOptions.md b/docs/framework/lit/reference/functions/queryOptions.md index 2b3aeecb5f8..9aa524e9010 100644 --- a/docs/framework/lit/reference/functions/queryOptions.md +++ b/docs/framework/lit/reference/functions/queryOptions.md @@ -8,9 +8,15 @@ title: queryOptions ## Overview ```ts -function queryOptions(options: DefinedInitialDataOptions): DefinedInitialDataOptions & object; -function queryOptions(options: UnusedSkipTokenOptions): UnusedSkipTokenOptions & object; -function queryOptions(options: UndefinedInitialDataOptions): UndefinedInitialDataOptions & object; +function queryOptions(options: DefinedInitialDataOptions): DefinedInitialDataOptions & { + queryKey: DataTag; +}; +function queryOptions(options: UnusedSkipTokenOptions): UnusedSkipTokenOptions & { + queryKey: DataTag; +}; +function queryOptions(options: UndefinedInitialDataOptions): UndefinedInitialDataOptions & { + queryKey: DataTag; +}; ``` - [`DefinedInitialDataOptions` → `DefinedInitialDataOptions & { queryKey }`](#call-signature-1): Brands query options so the `queryKey` carries the query function data and error types across TanStack Query APIs. @@ -24,7 +30,9 @@ See also: [Parameters](#parameters-summary) · [Returns](#returns-summary) ## Call Signature ```ts -function queryOptions(options: DefinedInitialDataOptions): DefinedInitialDataOptions & object; +function queryOptions(options: DefinedInitialDataOptions): DefinedInitialDataOptions & { + queryKey: DataTag; +}; ``` Defined in: [packages/lit-query/src/queryOptions.ts:92](https://github.com/TanStack/query/blob/main/packages/lit-query/src/queryOptions.ts#L92) @@ -60,7 +68,9 @@ Query options to preserve and brand. ### Returns -[`DefinedInitialDataOptions`](../type-aliases/DefinedInitialDataOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\> & `object` +[`DefinedInitialDataOptions`](../type-aliases/DefinedInitialDataOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\> & \{ + `queryKey`: [`DataTag`](../type-aliases/DataTag.md)\<`TQueryKey`, `TQueryFnData`, `TError`\>; +\} The same options object with a typed `queryKey`. @@ -81,7 +91,9 @@ const todosOptions = queryOptions({ ## Call Signature ```ts -function queryOptions(options: UnusedSkipTokenOptions): UnusedSkipTokenOptions & object; +function queryOptions(options: UnusedSkipTokenOptions): UnusedSkipTokenOptions & { + queryKey: DataTag; +}; ``` Defined in: [packages/lit-query/src/queryOptions.ts:109](https://github.com/TanStack/query/blob/main/packages/lit-query/src/queryOptions.ts#L109) @@ -117,7 +129,9 @@ Query options to preserve and brand. ### Returns -[`UnusedSkipTokenOptions`](../type-aliases/UnusedSkipTokenOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\> & `object` +[`UnusedSkipTokenOptions`](../type-aliases/UnusedSkipTokenOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\> & \{ + `queryKey`: [`DataTag`](../type-aliases/DataTag.md)\<`TQueryKey`, `TQueryFnData`, `TError`\>; +\} The same options object with a typed `queryKey`. @@ -126,7 +140,9 @@ The same options object with a typed `queryKey`. ## Call Signature ```ts -function queryOptions(options: UndefinedInitialDataOptions): UndefinedInitialDataOptions & object; +function queryOptions(options: UndefinedInitialDataOptions): UndefinedInitialDataOptions & { + queryKey: DataTag; +}; ``` Defined in: [packages/lit-query/src/queryOptions.ts:126](https://github.com/TanStack/query/blob/main/packages/lit-query/src/queryOptions.ts#L126) @@ -162,7 +178,9 @@ Query options to preserve and brand. ### Returns -[`UndefinedInitialDataOptions`](../type-aliases/UndefinedInitialDataOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\> & `object` +[`UndefinedInitialDataOptions`](../type-aliases/UndefinedInitialDataOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\> & \{ + `queryKey`: [`DataTag`](../type-aliases/DataTag.md)\<`TQueryKey`, `TQueryFnData`, `TError`\>; +\} The same options object with a typed `queryKey`. @@ -186,7 +204,9 @@ Built from [`QueryObserverOptions`](../interfaces/QueryObserverOptions.md#proper ## Returns -[`UndefinedInitialDataOptions`](../type-aliases/UndefinedInitialDataOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\> & `object` +[`UndefinedInitialDataOptions`](../type-aliases/UndefinedInitialDataOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\> & \{ + `queryKey`: [`DataTag`](../type-aliases/DataTag.md)\<`TQueryKey`, `TQueryFnData`, `TError`\>; +\} The same options object with a typed `queryKey`. diff --git a/docs/framework/lit/reference/interfaces/DefaultOptions.md b/docs/framework/lit/reference/interfaces/DefaultOptions.md index 25628a573fb..f26d4b5519c 100644 --- a/docs/framework/lit/reference/interfaces/DefaultOptions.md +++ b/docs/framework/lit/reference/interfaces/DefaultOptions.md @@ -21,7 +21,7 @@ The default options of a `QueryClient`, applied to every query (`queries`), muta | Property | Type | Description | | ------ | ------ | ------ | | `dehydrate?` | [`DehydrateOptions`](DehydrateOptions.md) | Default options used when dehydrating the client's caches; see [DehydrateOptions](DehydrateOptions.md). | -| `hydrate?` | `object` | Default options used when hydrating queries and mutations; see [HydrateOptions](HydrateOptions.md). | +| `hydrate?` | \{ `deserializeData?`: `TransformerFn`; `mutations?`: [`MutationOptions`](MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: [`QueryOptions`](QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \} | Default options used when hydrating queries and mutations; see [HydrateOptions](HydrateOptions.md). | | `hydrate.deserializeData?` | `TransformerFn` | Transforms a query's `data` after it is read from the dehydrated state, reversing `serializeData`. | | `hydrate.mutations?` | [`MutationOptions`](MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\> | Default options merged into every mutation restored from the dehydrated state. | | `hydrate.queries?` | [`QueryOptions`](QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\> | Default options merged into every query restored from the dehydrated state. | diff --git a/docs/framework/lit/reference/interfaces/EnsureQueryDataOptions.md b/docs/framework/lit/reference/interfaces/EnsureQueryDataOptions.md index 489415d5d37..8ab6c8bf8b8 100644 --- a/docs/framework/lit/reference/interfaces/EnsureQueryDataOptions.md +++ b/docs/framework/lit/reference/interfaces/EnsureQueryDataOptions.md @@ -46,10 +46,10 @@ Defined in: [packages/query-core/src/types.ts:774](https://github.com/TanStack/q | ~~`maxPages?`~~ | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | ~~`meta?`~~ | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | ~~`networkMode?`~~ | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | ~~`queryFn?`~~ | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | ~~`queryHash?`~~ | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| ~~`queryKey`~~ | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| ~~`queryKey`~~ | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | ~~`queryKeyHashFn?`~~ | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | ~~`retry?`~~ | \| `number` \| `false` \| `true` \| ((`failureCount`: `number`, `error`: `TError`) => `boolean`) | `undefined` | If `false`, failed queries will not retry by default. If `true`, failed queries will retry infinitely. If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number. If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false. Defaults to `3` on the client and `0` on the server. | | ~~`retryDelay?`~~ | `number` \| ((`failureCount`: `number`, `error`: `TError`) => `number`) | `undefined` | This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. A function like `attempt => attempt * 1000` applies linear backoff. Defaults to a function that applies exponential backoff, capped at 30 seconds. | diff --git a/docs/framework/lit/reference/interfaces/FetchQueryOptions.md b/docs/framework/lit/reference/interfaces/FetchQueryOptions.md index 5a288291ebd..d6fcdc3ef78 100644 --- a/docs/framework/lit/reference/interfaces/FetchQueryOptions.md +++ b/docs/framework/lit/reference/interfaces/FetchQueryOptions.md @@ -50,10 +50,10 @@ Defined in: [packages/query-core/src/types.ts:752](https://github.com/TanStack/q | ~~`maxPages?`~~ | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | ~~`meta?`~~ | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | ~~`networkMode?`~~ | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | ~~`queryFn?`~~ | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | ~~`queryHash?`~~ | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| ~~`queryKey`~~ | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| ~~`queryKey`~~ | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | ~~`queryKeyHashFn?`~~ | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | ~~`retry?`~~ | \| `number` \| `false` \| `true` \| ((`failureCount`: `number`, `error`: `TError`) => `boolean`) | `undefined` | If `false`, failed queries will not retry by default. If `true`, failed queries will retry infinitely. If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number. If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false. Defaults to `3` on the client and `0` on the server. | | ~~`retryDelay?`~~ | `number` \| ((`failureCount`: `number`, `error`: `TError`) => `number`) | `undefined` | This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. A function like `attempt => attempt * 1000` applies linear backoff. Defaults to a function that applies exponential backoff, capped at 30 seconds. | diff --git a/docs/framework/lit/reference/interfaces/HydrateOptions.md b/docs/framework/lit/reference/interfaces/HydrateOptions.md index f070f729ff9..1dd5de960ae 100644 --- a/docs/framework/lit/reference/interfaces/HydrateOptions.md +++ b/docs/framework/lit/reference/interfaces/HydrateOptions.md @@ -14,7 +14,7 @@ Options for `hydrate`, controlling the default options applied to queries/mutati | Property | Type | Description | | ------ | ------ | ------ | -| `defaultOptions?` | `object` | Options applied to the queries and mutations restored from the dehydrated state. | +| `defaultOptions?` | \{ `deserializeData?`: `TransformerFn`; `mutations?`: [`MutationOptions`](MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: [`QueryOptions`](QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \} | Options applied to the queries and mutations restored from the dehydrated state. | | `defaultOptions.deserializeData?` | `TransformerFn` | Transforms a query's `data` after it is read from the dehydrated state, reversing `serializeData`. | | `defaultOptions.mutations?` | [`MutationOptions`](MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\> | Default options merged into every mutation restored from the dehydrated state. | | `defaultOptions.queries?` | [`QueryOptions`](QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\> | Default options merged into every query restored from the dehydrated state. | diff --git a/docs/framework/lit/reference/interfaces/InfiniteQueryObserverOptions.md b/docs/framework/lit/reference/interfaces/InfiniteQueryObserverOptions.md index 418e3d41ebf..c8cbb098e8a 100644 --- a/docs/framework/lit/reference/interfaces/InfiniteQueryObserverOptions.md +++ b/docs/framework/lit/reference/interfaces/InfiniteQueryObserverOptions.md @@ -52,11 +52,11 @@ The options of an `InfiniteQueryObserver`: [QueryObserverOptions](QueryObserverO | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| ((`previousData`: \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<[`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TError`, [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\> \| `undefined`) => \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/lit/reference/interfaces/QueryExecuteOptions.md b/docs/framework/lit/reference/interfaces/QueryExecuteOptions.md index a14c79bfc19..0f472791f1e 100644 --- a/docs/framework/lit/reference/interfaces/QueryExecuteOptions.md +++ b/docs/framework/lit/reference/interfaces/QueryExecuteOptions.md @@ -52,10 +52,10 @@ transforms the value the call resolves with. | `maxPages?` | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `retry?` | \| `number` \| `false` \| `true` \| ((`failureCount`: `number`, `error`: `TError`) => `boolean`) | `undefined` | If `false`, failed queries will not retry by default. If `true`, failed queries will retry infinitely. If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number. If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false. Defaults to `3` on the client and `0` on the server. | | `retryDelay?` | `number` \| ((`failureCount`: `number`, `error`: `TError`) => `number`) | `undefined` | This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. A function like `attempt => attempt * 1000` applies linear backoff. Defaults to a function that applies exponential backoff, capped at 30 seconds. | diff --git a/docs/framework/lit/reference/interfaces/QueryObserverOptions.md b/docs/framework/lit/reference/interfaces/QueryObserverOptions.md index eb842bc6f56..2f426489dee 100644 --- a/docs/framework/lit/reference/interfaces/QueryObserverOptions.md +++ b/docs/framework/lit/reference/interfaces/QueryObserverOptions.md @@ -57,11 +57,11 @@ The options of a `QueryObserver`, and of the hooks built on it like `useQuery`: | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| `NonFunctionGuard`\<`TQueryData`\> \| ((`previousData`: `NonFunctionGuard`\<`TQueryData`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<`NonFunctionGuard`\<`TQueryData`\>, `TError`, `NonFunctionGuard`\<`TQueryData`\>, `TQueryKey`\> \| `undefined`) => `NonFunctionGuard`\<`TQueryData`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, `TQueryData`, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/lit/reference/interfaces/QueryOptions.md b/docs/framework/lit/reference/interfaces/QueryOptions.md index 574f08b670a..72c9a70ab0e 100644 --- a/docs/framework/lit/reference/interfaces/QueryOptions.md +++ b/docs/framework/lit/reference/interfaces/QueryOptions.md @@ -42,7 +42,7 @@ The options of a query itself — its `queryKey`, `queryFn`, retries, `gcTime`, | `maxPages?` | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `queryFn?` | \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) \| *typeof* [`skipToken`](../variables/skipToken.md) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | | `queryKey?` | `TQueryKey` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | diff --git a/docs/framework/lit/reference/type-aliases/AnyDataTag.md b/docs/framework/lit/reference/type-aliases/AnyDataTag.md index 4b9304ed2ee..65d582ac8aa 100644 --- a/docs/framework/lit/reference/type-aliases/AnyDataTag.md +++ b/docs/framework/lit/reference/type-aliases/AnyDataTag.md @@ -6,7 +6,10 @@ title: AnyDataTag ```ts -type AnyDataTag = object; +type AnyDataTag = { + [dataTagErrorSymbol]: any; + [dataTagSymbol]: any; +}; ``` Defined in: [packages/query-core/src/types.ts:122](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L122) diff --git a/docs/framework/lit/reference/type-aliases/CreateQueriesControllerOptions.md b/docs/framework/lit/reference/type-aliases/CreateQueriesControllerOptions.md index ee487ceddb7..9bde9447ae3 100644 --- a/docs/framework/lit/reference/type-aliases/CreateQueriesControllerOptions.md +++ b/docs/framework/lit/reference/type-aliases/CreateQueriesControllerOptions.md @@ -6,7 +6,12 @@ title: CreateQueriesControllerOptions ```ts -type CreateQueriesControllerOptions> = object; +type CreateQueriesControllerOptions> = { + combine?: (result: CreateQueriesResults) => TCombinedResult; + queries: Accessor< + | readonly [...CreateQueriesOptions] + | readonly [...{ [K in keyof TQueryOptions]: GetCreateQueriesInput }]>; +}; ``` Defined in: [packages/lit-query/src/createQueriesController.ts:190](https://github.com/TanStack/query/blob/main/packages/lit-query/src/createQueriesController.ts#L190) diff --git a/docs/framework/lit/reference/type-aliases/DataTag.md b/docs/framework/lit/reference/type-aliases/DataTag.md index 6e5cbfd46b9..22389c45a62 100644 --- a/docs/framework/lit/reference/type-aliases/DataTag.md +++ b/docs/framework/lit/reference/type-aliases/DataTag.md @@ -6,7 +6,10 @@ title: DataTag ```ts -type DataTag = TType extends AnyDataTag ? TType : TType & object; +type DataTag = TType extends AnyDataTag ? TType : TType & { + [dataTagErrorSymbol]: TError; + [dataTagSymbol]: TValue; +}; ``` Defined in: [packages/query-core/src/types.ts:137](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L137) diff --git a/docs/framework/lit/reference/type-aliases/DefaultError.md b/docs/framework/lit/reference/type-aliases/DefaultError.md index 85150115168..1db2fd40ed7 100644 --- a/docs/framework/lit/reference/type-aliases/DefaultError.md +++ b/docs/framework/lit/reference/type-aliases/DefaultError.md @@ -6,7 +6,9 @@ title: DefaultError ```ts -type DefaultError = Register extends object ? TError : Error; +type DefaultError = Register extends { + defaultError: infer TError; +} ? TError : Error; ``` Defined in: [packages/query-core/src/types.ts:83](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L83) diff --git a/docs/framework/lit/reference/type-aliases/DefinedInitialDataOptions.md b/docs/framework/lit/reference/type-aliases/DefinedInitialDataOptions.md index e8c1e7f10b0..441c19ed4af 100644 --- a/docs/framework/lit/reference/type-aliases/DefinedInitialDataOptions.md +++ b/docs/framework/lit/reference/type-aliases/DefinedInitialDataOptions.md @@ -6,7 +6,11 @@ title: DefinedInitialDataOptions ```ts -type DefinedInitialDataOptions = Omit, "queryFn"> & object; +type DefinedInitialDataOptions = Omit, "queryFn"> & { + initialData: | NonUndefinedGuard + | (() => NonUndefinedGuard); + queryFn?: QueryFunction; +}; ``` Defined in: [packages/lit-query/src/queryOptions.ts:16](https://github.com/TanStack/query/blob/main/packages/lit-query/src/queryOptions.ts#L16) diff --git a/docs/framework/lit/reference/type-aliases/EnsureInfiniteQueryDataOptions.md b/docs/framework/lit/reference/type-aliases/EnsureInfiniteQueryDataOptions.md index 1142c9bf005..d9c876a6029 100644 --- a/docs/framework/lit/reference/type-aliases/EnsureInfiniteQueryDataOptions.md +++ b/docs/framework/lit/reference/type-aliases/EnsureInfiniteQueryDataOptions.md @@ -6,7 +6,9 @@ title: EnsureInfiniteQueryDataOptions ```ts -type EnsureInfiniteQueryDataOptions = FetchInfiniteQueryOptions & object; +type EnsureInfiniteQueryDataOptions = FetchInfiniteQueryOptions & { + revalidateIfStale?: boolean; +}; ``` Defined in: [packages/query-core/src/types.ts:794](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L794) diff --git a/docs/framework/lit/reference/type-aliases/InfiniteQueryResultAccessor.md b/docs/framework/lit/reference/type-aliases/InfiniteQueryResultAccessor.md index f57ac589e21..e652058eff2 100644 --- a/docs/framework/lit/reference/type-aliases/InfiniteQueryResultAccessor.md +++ b/docs/framework/lit/reference/type-aliases/InfiniteQueryResultAccessor.md @@ -6,7 +6,12 @@ title: InfiniteQueryResultAccessor ```ts -type InfiniteQueryResultAccessor = ValueAccessor> & object; +type InfiniteQueryResultAccessor = ValueAccessor> & { + destroy: () => void; + fetchNextPage: InfiniteQueryObserverResult["fetchNextPage"]; + fetchPreviousPage: InfiniteQueryObserverResult["fetchPreviousPage"]; + refetch: InfiniteQueryObserverResult["refetch"]; +}; ``` Defined in: [packages/lit-query/src/createInfiniteQueryController.ts:45](https://github.com/TanStack/query/blob/main/packages/lit-query/src/createInfiniteQueryController.ts#L45) diff --git a/docs/framework/lit/reference/type-aliases/IsFetchingAccessor.md b/docs/framework/lit/reference/type-aliases/IsFetchingAccessor.md index 41f363a9485..cc13961f8af 100644 --- a/docs/framework/lit/reference/type-aliases/IsFetchingAccessor.md +++ b/docs/framework/lit/reference/type-aliases/IsFetchingAccessor.md @@ -6,7 +6,9 @@ title: IsFetchingAccessor ```ts -type IsFetchingAccessor = ValueAccessor & object; +type IsFetchingAccessor = ValueAccessor & { + destroy: () => void; +}; ``` Defined in: [packages/lit-query/src/useIsFetching.ts:13](https://github.com/TanStack/query/blob/main/packages/lit-query/src/useIsFetching.ts#L13) diff --git a/docs/framework/lit/reference/type-aliases/IsMutatingAccessor.md b/docs/framework/lit/reference/type-aliases/IsMutatingAccessor.md index b1eadc5170b..4674e78b92a 100644 --- a/docs/framework/lit/reference/type-aliases/IsMutatingAccessor.md +++ b/docs/framework/lit/reference/type-aliases/IsMutatingAccessor.md @@ -6,7 +6,9 @@ title: IsMutatingAccessor ```ts -type IsMutatingAccessor = ValueAccessor & object; +type IsMutatingAccessor = ValueAccessor & { + destroy: () => void; +}; ``` Defined in: [packages/lit-query/src/useIsMutating.ts:13](https://github.com/TanStack/query/blob/main/packages/lit-query/src/useIsMutating.ts#L13) diff --git a/docs/framework/lit/reference/type-aliases/MutationFunctionContext.md b/docs/framework/lit/reference/type-aliases/MutationFunctionContext.md index 39a5d19316a..4b2d040ca9a 100644 --- a/docs/framework/lit/reference/type-aliases/MutationFunctionContext.md +++ b/docs/framework/lit/reference/type-aliases/MutationFunctionContext.md @@ -6,7 +6,11 @@ title: MutationFunctionContext ```ts -type MutationFunctionContext = object; +type MutationFunctionContext = { + client: QueryClient; + meta: MutationMeta | undefined; + mutationKey?: MutationKey; +}; ``` Defined in: [packages/query-core/src/types.ts:1855](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1855) diff --git a/docs/framework/lit/reference/type-aliases/MutationKey.md b/docs/framework/lit/reference/type-aliases/MutationKey.md index 7c598833c16..372431c32fb 100644 --- a/docs/framework/lit/reference/type-aliases/MutationKey.md +++ b/docs/framework/lit/reference/type-aliases/MutationKey.md @@ -6,7 +6,9 @@ title: MutationKey ```ts -type MutationKey = Register extends object ? TMutationKey extends ReadonlyArray ? TMutationKey : TMutationKey extends unknown[] ? TMutationKey : ReadonlyArray : ReadonlyArray; +type MutationKey = Register extends { + mutationKey: infer TMutationKey; +} ? TMutationKey extends ReadonlyArray ? TMutationKey : TMutationKey extends unknown[] ? TMutationKey : ReadonlyArray : ReadonlyArray; ``` Defined in: [packages/query-core/src/types.ts:1814](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1814) diff --git a/docs/framework/lit/reference/type-aliases/MutationMeta.md b/docs/framework/lit/reference/type-aliases/MutationMeta.md index 2b7dc7446ae..ddac47dcfc4 100644 --- a/docs/framework/lit/reference/type-aliases/MutationMeta.md +++ b/docs/framework/lit/reference/type-aliases/MutationMeta.md @@ -6,7 +6,9 @@ title: MutationMeta ```ts -type MutationMeta = Register extends object ? TMutationMeta extends Record ? TMutationMeta : Record : Record; +type MutationMeta = Register extends { + mutationMeta: infer TMutationMeta; +} ? TMutationMeta extends Record ? TMutationMeta : Record : Record; ``` Defined in: [packages/query-core/src/types.ts:1843](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1843) diff --git a/docs/framework/lit/reference/type-aliases/MutationResultAccessor.md b/docs/framework/lit/reference/type-aliases/MutationResultAccessor.md index 0b106404d76..fb9a4a5bdaa 100644 --- a/docs/framework/lit/reference/type-aliases/MutationResultAccessor.md +++ b/docs/framework/lit/reference/type-aliases/MutationResultAccessor.md @@ -6,7 +6,12 @@ title: MutationResultAccessor ```ts -type MutationResultAccessor = ValueAccessor> & object; +type MutationResultAccessor = ValueAccessor> & { + destroy: () => void; + mutate: (...args: Parameters>) => void; + mutateAsync: MutationObserverResult["mutate"]; + reset: MutationObserverResult["reset"]; +}; ``` Defined in: [packages/lit-query/src/createMutationController.ts:34](https://github.com/TanStack/query/blob/main/packages/lit-query/src/createMutationController.ts#L34) diff --git a/docs/framework/lit/reference/type-aliases/MutationScope.md b/docs/framework/lit/reference/type-aliases/MutationScope.md index 4357b2d629d..f859dc913a9 100644 --- a/docs/framework/lit/reference/type-aliases/MutationScope.md +++ b/docs/framework/lit/reference/type-aliases/MutationScope.md @@ -6,7 +6,9 @@ title: MutationScope ```ts -type MutationScope = object; +type MutationScope = { + id: string; +}; ``` Defined in: [packages/query-core/src/types.ts:1832](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1832) diff --git a/docs/framework/lit/reference/type-aliases/MutationStateAccessor.md b/docs/framework/lit/reference/type-aliases/MutationStateAccessor.md index 1dd2418a1d9..774ccb00da9 100644 --- a/docs/framework/lit/reference/type-aliases/MutationStateAccessor.md +++ b/docs/framework/lit/reference/type-aliases/MutationStateAccessor.md @@ -6,7 +6,9 @@ title: MutationStateAccessor ```ts -type MutationStateAccessor = ValueAccessor & object; +type MutationStateAccessor = ValueAccessor & { + destroy: () => void; +}; ``` Defined in: [packages/lit-query/src/useMutationState.ts:29](https://github.com/TanStack/query/blob/main/packages/lit-query/src/useMutationState.ts#L29) diff --git a/docs/framework/lit/reference/type-aliases/MutationStateOptions.md b/docs/framework/lit/reference/type-aliases/MutationStateOptions.md index ff240eaafe8..28d493ac3fb 100644 --- a/docs/framework/lit/reference/type-aliases/MutationStateOptions.md +++ b/docs/framework/lit/reference/type-aliases/MutationStateOptions.md @@ -6,7 +6,10 @@ title: MutationStateOptions ```ts -type MutationStateOptions = object; +type MutationStateOptions = { + filters?: Accessor; + select?: (mutation: Mutation) => TResult; +}; ``` Defined in: [packages/lit-query/src/useMutationState.ts:16](https://github.com/TanStack/query/blob/main/packages/lit-query/src/useMutationState.ts#L16) diff --git a/docs/framework/lit/reference/type-aliases/QueriesResultAccessor.md b/docs/framework/lit/reference/type-aliases/QueriesResultAccessor.md index 73c727f6f8e..5eae76463e6 100644 --- a/docs/framework/lit/reference/type-aliases/QueriesResultAccessor.md +++ b/docs/framework/lit/reference/type-aliases/QueriesResultAccessor.md @@ -6,7 +6,9 @@ title: QueriesResultAccessor ```ts -type QueriesResultAccessor = ValueAccessor & object; +type QueriesResultAccessor = ValueAccessor & { + destroy: () => void; +}; ``` Defined in: [packages/lit-query/src/createQueriesController.ts:213](https://github.com/TanStack/query/blob/main/packages/lit-query/src/createQueriesController.ts#L213) diff --git a/docs/framework/lit/reference/type-aliases/QueryFunctionContext.md b/docs/framework/lit/reference/type-aliases/QueryFunctionContext.md index 15a8d2e9261..59324fb3aeb 100644 --- a/docs/framework/lit/reference/type-aliases/QueryFunctionContext.md +++ b/docs/framework/lit/reference/type-aliases/QueryFunctionContext.md @@ -6,7 +6,21 @@ title: QueryFunctionContext ```ts -type QueryFunctionContext = [TPageParam] extends [never] ? object : object; +type QueryFunctionContext = [TPageParam] extends [never] ? { + client: QueryClient; + direction?: unknown; + meta: QueryMeta | undefined; + pageParam?: unknown; + queryKey: TQueryKey; + signal: AbortSignal; +} : { + client: QueryClient; + direction: FetchDirection; + meta: QueryMeta | undefined; + pageParam: TPageParam; + queryKey: TQueryKey; + signal: AbortSignal; +}; ``` Defined in: [packages/query-core/src/types.ts:235](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L235) diff --git a/docs/framework/lit/reference/type-aliases/QueryKey.md b/docs/framework/lit/reference/type-aliases/QueryKey.md index 6a2c8ca5503..d358486f29b 100644 --- a/docs/framework/lit/reference/type-aliases/QueryKey.md +++ b/docs/framework/lit/reference/type-aliases/QueryKey.md @@ -6,7 +6,9 @@ title: QueryKey ```ts -type QueryKey = Register extends object ? TQueryKey extends ReadonlyArray ? TQueryKey : TQueryKey extends unknown[] ? TQueryKey : ReadonlyArray : ReadonlyArray; +type QueryKey = Register extends { + queryKey: infer TQueryKey; +} ? TQueryKey extends ReadonlyArray ? TQueryKey : TQueryKey extends unknown[] ? TQueryKey : ReadonlyArray : ReadonlyArray; ``` Defined in: [packages/query-core/src/types.ts:93](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L93) diff --git a/docs/framework/lit/reference/type-aliases/QueryKeyWithDataTag.md b/docs/framework/lit/reference/type-aliases/QueryKeyWithDataTag.md index 60244136ec1..f4c0ab86c9a 100644 --- a/docs/framework/lit/reference/type-aliases/QueryKeyWithDataTag.md +++ b/docs/framework/lit/reference/type-aliases/QueryKeyWithDataTag.md @@ -6,7 +6,9 @@ title: QueryKeyWithDataTag ```ts -type QueryKeyWithDataTag = object; +type QueryKeyWithDataTag = { + queryKey: DataTag; +}; ``` Defined in: [packages/query-core/src/types.ts:152](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L152) diff --git a/docs/framework/lit/reference/type-aliases/QueryMeta.md b/docs/framework/lit/reference/type-aliases/QueryMeta.md index 3df2e5a17bd..6f1b27a3d9e 100644 --- a/docs/framework/lit/reference/type-aliases/QueryMeta.md +++ b/docs/framework/lit/reference/type-aliases/QueryMeta.md @@ -6,7 +6,9 @@ title: QueryMeta ```ts -type QueryMeta = Register extends object ? TQueryMeta extends Record ? TQueryMeta : Record : Record; +type QueryMeta = Register extends { + queryMeta: infer TQueryMeta; +} ? TQueryMeta extends Record ? TQueryMeta : Record : Record; ``` Defined in: [packages/query-core/src/types.ts:330](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L330) diff --git a/docs/framework/lit/reference/type-aliases/QueryResultAccessor.md b/docs/framework/lit/reference/type-aliases/QueryResultAccessor.md index c9a3a48c2c4..8f2dc174ebd 100644 --- a/docs/framework/lit/reference/type-aliases/QueryResultAccessor.md +++ b/docs/framework/lit/reference/type-aliases/QueryResultAccessor.md @@ -6,7 +6,11 @@ title: QueryResultAccessor ```ts -type QueryResultAccessor = ValueAccessor> & object; +type QueryResultAccessor = ValueAccessor> & { + destroy: () => void; + refetch: QueryObserverResult["refetch"]; + suspense: () => Promise>; +}; ``` Defined in: [packages/lit-query/src/createQueryController.ts:38](https://github.com/TanStack/query/blob/main/packages/lit-query/src/createQueryController.ts#L38) diff --git a/docs/framework/lit/reference/type-aliases/TimeoutProvider.md b/docs/framework/lit/reference/type-aliases/TimeoutProvider.md index 6e3fd194540..88cd72aa7e3 100644 --- a/docs/framework/lit/reference/type-aliases/TimeoutProvider.md +++ b/docs/framework/lit/reference/type-aliases/TimeoutProvider.md @@ -6,7 +6,12 @@ title: TimeoutProvider ```ts -type TimeoutProvider = object; +type TimeoutProvider = { + clearInterval: (intervalId: TTimerId | undefined) => void; + clearTimeout: (timeoutId: TTimerId | undefined) => void; + setInterval: (callback: TimeoutCallback, delay: number) => TTimerId; + setTimeout: (callback: TimeoutCallback, delay: number) => TTimerId; +}; ``` Defined in: [packages/query-core/src/timeoutManager.ts:28](https://github.com/TanStack/query/blob/main/packages/query-core/src/timeoutManager.ts#L28) diff --git a/docs/framework/lit/reference/type-aliases/UndefinedInitialDataOptions.md b/docs/framework/lit/reference/type-aliases/UndefinedInitialDataOptions.md index f42b8dcf6df..63ff2c6d5b1 100644 --- a/docs/framework/lit/reference/type-aliases/UndefinedInitialDataOptions.md +++ b/docs/framework/lit/reference/type-aliases/UndefinedInitialDataOptions.md @@ -6,7 +6,10 @@ title: UndefinedInitialDataOptions ```ts -type UndefinedInitialDataOptions = QueryObserverOptions & object; +type UndefinedInitialDataOptions = QueryObserverOptions & { + initialData?: | InitialDataFunction> + | NonUndefinedGuard; +}; ``` Defined in: [packages/lit-query/src/queryOptions.ts:58](https://github.com/TanStack/query/blob/main/packages/lit-query/src/queryOptions.ts#L58) diff --git a/docs/framework/lit/reference/type-aliases/UnusedSkipTokenOptions.md b/docs/framework/lit/reference/type-aliases/UnusedSkipTokenOptions.md index f271aae30d5..cdda8bf556a 100644 --- a/docs/framework/lit/reference/type-aliases/UnusedSkipTokenOptions.md +++ b/docs/framework/lit/reference/type-aliases/UnusedSkipTokenOptions.md @@ -6,7 +6,9 @@ title: UnusedSkipTokenOptions ```ts -type UnusedSkipTokenOptions = OmitKeyof, "queryFn"> & object; +type UnusedSkipTokenOptions = OmitKeyof, "queryFn"> & { + queryFn?: Exclude["queryFn"], SkipToken | undefined>; +}; ``` Defined in: [packages/lit-query/src/queryOptions.ts:34](https://github.com/TanStack/query/blob/main/packages/lit-query/src/queryOptions.ts#L34) diff --git a/docs/framework/lit/reference/type-aliases/ValueAccessor.md b/docs/framework/lit/reference/type-aliases/ValueAccessor.md index fafe19918d8..f5355562ae6 100644 --- a/docs/framework/lit/reference/type-aliases/ValueAccessor.md +++ b/docs/framework/lit/reference/type-aliases/ValueAccessor.md @@ -6,7 +6,9 @@ title: ValueAccessor ```ts -type ValueAccessor = () => T & object; +type ValueAccessor = () => T & { + current: T; +}; ``` Defined in: [packages/lit-query/src/accessor.ts:35](https://github.com/TanStack/query/blob/main/packages/lit-query/src/accessor.ts#L35) diff --git a/docs/framework/lit/reference/variables/environmentManager.md b/docs/framework/lit/reference/variables/environmentManager.md index 40b82d3a2de..4e8224270d3 100644 --- a/docs/framework/lit/reference/variables/environmentManager.md +++ b/docs/framework/lit/reference/variables/environmentManager.md @@ -6,7 +6,10 @@ title: environmentManager ```ts -const environmentManager: object; +const environmentManager: { + isServer: () => boolean; + setIsServer(isServerValue: IsServerValue): void; +}; ``` Defined in: [packages/query-core/src/environmentManager.ts:32](https://github.com/TanStack/query/blob/main/packages/query-core/src/environmentManager.ts#L32) diff --git a/docs/framework/lit/reference/variables/notifyManager.md b/docs/framework/lit/reference/variables/notifyManager.md index 82290f7f19a..5ddda37894d 100644 --- a/docs/framework/lit/reference/variables/notifyManager.md +++ b/docs/framework/lit/reference/variables/notifyManager.md @@ -6,7 +6,14 @@ title: notifyManager ```ts -const notifyManager: object; +const notifyManager: { + batch: (callback: () => T) => T; + batchCalls: (callback: BatchCallsCallback) => BatchCallsCallback; + schedule: (callback: NotifyCallback) => void; + setBatchNotifyFunction: (fn: BatchNotifyFunction) => void; + setNotifyFunction: (fn: NotifyFunction) => void; + setScheduler: (fn: ScheduleFunction) => void; +}; ``` Defined in: [packages/query-core/src/notifyManager.ts:154](https://github.com/TanStack/query/blob/main/packages/query-core/src/notifyManager.ts#L154) diff --git a/docs/framework/lit/reference/variables/queryClientContext.md b/docs/framework/lit/reference/variables/queryClientContext.md index 4c67c4aa79d..ca10be0d16c 100644 --- a/docs/framework/lit/reference/variables/queryClientContext.md +++ b/docs/framework/lit/reference/variables/queryClientContext.md @@ -6,7 +6,8 @@ title: queryClientContext ```ts -const queryClientContext: object; +const queryClientContext: { +}; ``` Defined in: [packages/lit-query/src/context.ts:11](https://github.com/TanStack/query/blob/main/packages/lit-query/src/context.ts#L11) diff --git a/docs/framework/preact/reference/functions/HydrationBoundary.md b/docs/framework/preact/reference/functions/HydrationBoundary.md index 19ce33ff226..91e6ddfc8b2 100644 --- a/docs/framework/preact/reference/functions/HydrationBoundary.md +++ b/docs/framework/preact/reference/functions/HydrationBoundary.md @@ -33,7 +33,7 @@ The dehydrated `state` to hydrate, the hydrate `options`, an optional custom | Property | Type | Description | | ------ | ------ | ------ | | `children?` | `ComponentChildren` | The components to render — always rendered unconditionally, not gated on hydration. New queries are hydrated into the cache during render; for queries that already exist in the cache, only newer dehydrated data is hydrated, and that happens in an effect after commit, so `children` may render briefly before it lands. | -| `options?` | [`OmitKeyof`](../type-aliases/OmitKeyof.md)\<[`HydrateOptions`](../interfaces/HydrateOptions.md), `"defaultOptions"`\> & `object` | Optional. Note: unlike `hydrate`, `mutations` cannot be set here. | +| `options?` | [`OmitKeyof`](../type-aliases/OmitKeyof.md)\<[`HydrateOptions`](../interfaces/HydrateOptions.md), `"defaultOptions"`\> & \{ `defaultOptions?`: [`OmitKeyof`](../type-aliases/OmitKeyof.md)\<\{ `deserializeData?`: `TransformerFn`; `mutations?`: [`MutationOptions`](../interfaces/MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: [`QueryOptions`](../interfaces/QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \}, `"mutations"`\>; \} | Optional. Note: unlike `hydrate`, `mutations` cannot be set here. | | `queryClient?` | [`QueryClient`](../classes/QueryClient.md) | Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. | | `state` | [`DehydratedState`](../interfaces/DehydratedState.md) \| `null` \| `undefined` | The state to hydrate. | diff --git a/docs/framework/preact/reference/functions/experimental_streamedQuery.md b/docs/framework/preact/reference/functions/experimental_streamedQuery.md index 38ca68beefc..0ab1af0aa52 100644 --- a/docs/framework/preact/reference/functions/experimental_streamedQuery.md +++ b/docs/framework/preact/reference/functions/experimental_streamedQuery.md @@ -6,7 +6,14 @@ title: experimental_streamedQuery ```ts -function experimental_streamedQuery(options: StreamedQueryParams): (context: object) => TData | Promise; +function experimental_streamedQuery(options: StreamedQueryParams): (context: { + client: QueryClient; + direction?: unknown; + meta: Record | undefined; + pageParam?: unknown; + queryKey: TQueryKey; + signal: AbortSignal; +}) => TData | Promise; ``` Defined in: [packages/query-core/src/streamedQuery.ts:70](https://github.com/TanStack/query/blob/main/packages/query-core/src/streamedQuery.ts#L70) @@ -43,7 +50,14 @@ The `streamFn` that returns an AsyncIterable to stream data from, and the option A query function to pass as `queryFn`. -(`context`: `object`) => `TData` \| `Promise`\<`TData`\> +(`context`: \{ + `client`: [`QueryClient`](../classes/QueryClient.md); + `direction?`: `unknown`; + `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; + `pageParam?`: `unknown`; + `queryKey`: `TQueryKey`; + `signal`: `AbortSignal`; +\}) => `TData` \| `Promise`\<`TData`\> ## Example diff --git a/docs/framework/preact/reference/functions/hydrate.md b/docs/framework/preact/reference/functions/hydrate.md index 411978a70f8..aa8ca8ffd6e 100644 --- a/docs/framework/preact/reference/functions/hydrate.md +++ b/docs/framework/preact/reference/functions/hydrate.md @@ -56,7 +56,7 @@ client's `defaultOptions.hydrate`), and `deserializeData` to reverse `serializeD | Property | Type | Description | | ------ | ------ | ------ | -| `defaultOptions?` | `object` | Options applied to the queries and mutations restored from the dehydrated state. | +| `defaultOptions?` | \{ `deserializeData?`: `TransformerFn`; `mutations?`: [`MutationOptions`](../interfaces/MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: [`QueryOptions`](../interfaces/QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \} | Options applied to the queries and mutations restored from the dehydrated state. | | `defaultOptions.deserializeData?` | `TransformerFn` | Transforms a query's `data` after it is read from the dehydrated state, reversing `serializeData`. | | `defaultOptions.mutations?` | [`MutationOptions`](../interfaces/MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\> | Default options merged into every mutation restored from the dehydrated state. | | `defaultOptions.queries?` | [`QueryOptions`](../interfaces/QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\> | Default options merged into every query restored from the dehydrated state. | diff --git a/docs/framework/preact/reference/functions/useInfiniteQuery.md b/docs/framework/preact/reference/functions/useInfiniteQuery.md index 7ca0f0d62f9..6560b63c446 100644 --- a/docs/framework/preact/reference/functions/useInfiniteQuery.md +++ b/docs/framework/preact/reference/functions/useInfiniteQuery.md @@ -497,11 +497,11 @@ The [UseInfiniteQueryOptions](../interfaces/UseInfiniteQueryOptions.md) to use | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| ((`previousData`: \| [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<[`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TError`, [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\> \| `undefined`) => \| [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/preact/reference/functions/useQueries.md b/docs/framework/preact/reference/functions/useQueries.md index 81315043aa0..aba45611a61 100644 --- a/docs/framework/preact/reference/functions/useQueries.md +++ b/docs/framework/preact/reference/functions/useQueries.md @@ -6,7 +6,12 @@ title: useQueries ```ts -function useQueries] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseQueryResult, GetUseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseQueryResult, GetUseQueryResult, GetUseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : [...{ [K in string | number | symbol]: GetUseQueryResult }[]] : { [K in string | number | symbol]: GetUseQueryResult }>(options: object, queryClient?: QueryClient): TCombinedResult; +function useQueries] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseQueryResult, GetUseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseQueryResult, GetUseQueryResult, GetUseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : [...{ [K in string | number | symbol]: GetUseQueryResult }[]] : { [K in string | number | symbol]: GetUseQueryResult }>(options: { + combine?: (result: T extends [] ? [] : T extends [Head] ? [GetUseQueryResult] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseQueryResult, GetUseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : { [K in string | number | symbol]: GetUseQueryResult }) => TCombinedResult; + queries: | readonly [T extends [] ? [] : T extends [Head] ? [GetUseQueryOptionsForUseQueries] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseQueryOptionsForUseQueries, GetUseQueryOptionsForUseQueries] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : readonly ...[] extends [...(...)[]] ? [...(...)[]] : ... extends ... ? ... : ... : readonly unknown[] extends T ? T : T extends UseQueryOptionsForUseQueries[] ? UseQueryOptionsForUseQueries[] : UseQueryOptionsForUseQueries[]] + | readonly [{ [K in string | number | symbol]: GetUseQueryOptionsForUseQueries }]; + subscribed?: boolean; +}, queryClient?: QueryClient): TCombinedResult; ``` Defined in: [packages/preact-query/src/useQueries.ts:304](https://github.com/TanStack/query/blob/main/packages/preact-query/src/useQueries.ts#L304) diff --git a/docs/framework/preact/reference/functions/useQuery.md b/docs/framework/preact/reference/functions/useQuery.md index c0c5e842d46..4583c1d251d 100644 --- a/docs/framework/preact/reference/functions/useQuery.md +++ b/docs/framework/preact/reference/functions/useQuery.md @@ -436,11 +436,11 @@ The [UseQueryOptions](../interfaces/UseQueryOptions.md) to use — everything yo | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| `NonFunctionGuard`\<`TQueryFnData`\> \| ((`previousData`: `NonFunctionGuard`\<`TQueryFnData`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<`NonFunctionGuard`\<`TQueryFnData`\>, `TError`, `NonFunctionGuard`\<`TQueryFnData`\>, `TQueryKey`\> \| `undefined`) => `NonFunctionGuard`\<`TQueryFnData`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | -| `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | +| `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `TQueryKey`; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, `TQueryFnData`, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/preact/reference/functions/useSuspenseInfiniteQuery.md b/docs/framework/preact/reference/functions/useSuspenseInfiniteQuery.md index 9e63a9efccd..c7a3d4d387e 100644 --- a/docs/framework/preact/reference/functions/useSuspenseInfiniteQuery.md +++ b/docs/framework/preact/reference/functions/useSuspenseInfiniteQuery.md @@ -62,10 +62,10 @@ The [UseSuspenseInfiniteQueryOptions](../interfaces/UseSuspenseInfiniteQueryOpti | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `queryFn?` | (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | `skipToken` is not allowed here — Suspense hooks cannot render a "disabled" state, so a query function must always be provided, unless a default query function has been defined. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/preact/reference/functions/useSuspenseQueries.md b/docs/framework/preact/reference/functions/useSuspenseQueries.md index 604ce444b1a..3a211f6b08f 100644 --- a/docs/framework/preact/reference/functions/useSuspenseQueries.md +++ b/docs/framework/preact/reference/functions/useSuspenseQueries.md @@ -8,8 +8,15 @@ title: useSuspenseQueries ## Overview ```ts -function useSuspenseQueries] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : [...{ [K in string | number | symbol]: GetUseSuspenseQueryResult }[]] : { [K in string | number | symbol]: GetUseSuspenseQueryResult }>(options: object, queryClient?: QueryClient): TCombinedResult; -function useSuspenseQueries] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : [...{ [K in string | number | symbol]: GetUseSuspenseQueryResult }[]] : { [K in string | number | symbol]: GetUseSuspenseQueryResult }>(options: object, queryClient?: QueryClient): TCombinedResult; +function useSuspenseQueries] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : [...{ [K in string | number | symbol]: GetUseSuspenseQueryResult }[]] : { [K in string | number | symbol]: GetUseSuspenseQueryResult }>(options: { + combine?: (result: T extends [] ? [] : T extends [Head] ? [GetUseSuspenseQueryResult] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : { [K in string | number | symbol]: GetUseSuspenseQueryResult }) => TCombinedResult; + queries: | readonly [T extends [] ? [] : T extends [Head] ? [GetUseSuspenseQueryOptions] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryOptions, GetUseSuspenseQueryOptions] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : ...[] extends [...(...)[]] ? [...(...)[]] : ... extends ... ? ... : ... : unknown[] extends T ? T : T extends UseSuspenseQueryOptions[] ? UseSuspenseQueryOptions[] : UseSuspenseQueryOptions[]] + | readonly [{ [K in string | number | symbol]: GetUseSuspenseQueryOptions }]; +}, queryClient?: QueryClient): TCombinedResult; +function useSuspenseQueries] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : [...{ [K in string | number | symbol]: GetUseSuspenseQueryResult }[]] : { [K in string | number | symbol]: GetUseSuspenseQueryResult }>(options: { + combine?: (result: T extends [] ? [] : T extends [Head] ? [GetUseSuspenseQueryResult] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : { [K in string | number | symbol]: GetUseSuspenseQueryResult }) => TCombinedResult; + queries: readonly [T extends [] ? [] : T extends [Head] ? [GetUseSuspenseQueryOptions] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryOptions, GetUseSuspenseQueryOptions] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...(...)[]] extends [...] ? [..., ..., ...] : ... extends ... ? ... : ... : unknown[] extends [...Tails[]] ? [...Tails[]] : [...(...)[]] extends ...[] ? ...[] : ...[] : unknown[] extends T ? T : T extends UseSuspenseQueryOptions[] ? UseSuspenseQueryOptions[] : UseSuspenseQueryOptions[]]; +}, queryClient?: QueryClient): TCombinedResult; ``` - [`{ queries, combine }` → `TCombinedResult`](#call-signature-1): The options for `useSuspenseQueries` are the same as for `useQueries`, except that the top-level `subscribed` option isn't supported, and each `query` can't have `throwOnError`, `enabled`, or `placeholderData`. @@ -22,7 +29,11 @@ See also: [Parameters](#parameters-summary) · [Returns](#returns-summary) ## Call Signature ```ts -function useSuspenseQueries] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : [...{ [K in string | number | symbol]: GetUseSuspenseQueryResult }[]] : { [K in string | number | symbol]: GetUseSuspenseQueryResult }>(options: object, queryClient?: QueryClient): TCombinedResult; +function useSuspenseQueries] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : [...{ [K in string | number | symbol]: GetUseSuspenseQueryResult }[]] : { [K in string | number | symbol]: GetUseSuspenseQueryResult }>(options: { + combine?: (result: T extends [] ? [] : T extends [Head] ? [GetUseSuspenseQueryResult] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : { [K in string | number | symbol]: GetUseSuspenseQueryResult }) => TCombinedResult; + queries: | readonly [T extends [] ? [] : T extends [Head] ? [GetUseSuspenseQueryOptions] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryOptions, GetUseSuspenseQueryOptions] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : ...[] extends [...(...)[]] ? [...(...)[]] : ... extends ... ? ... : ... : unknown[] extends T ? T : T extends UseSuspenseQueryOptions[] ? UseSuspenseQueryOptions[] : UseSuspenseQueryOptions[]] + | readonly [{ [K in string | number | symbol]: GetUseSuspenseQueryOptions }]; +}, queryClient?: QueryClient): TCombinedResult; ``` Defined in: [packages/preact-query/src/useSuspenseQueries.ts:407](https://github.com/TanStack/query/blob/main/packages/preact-query/src/useSuspenseQueries.ts#L407) @@ -294,7 +305,10 @@ function ErrorBoundary({ ## Call Signature ```ts -function useSuspenseQueries] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : [...{ [K in string | number | symbol]: GetUseSuspenseQueryResult }[]] : { [K in string | number | symbol]: GetUseSuspenseQueryResult }>(options: object, queryClient?: QueryClient): TCombinedResult; +function useSuspenseQueries] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : [...{ [K in string | number | symbol]: GetUseSuspenseQueryResult }[]] : { [K in string | number | symbol]: GetUseSuspenseQueryResult }>(options: { + combine?: (result: T extends [] ? [] : T extends [Head] ? [GetUseSuspenseQueryResult] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : { [K in string | number | symbol]: GetUseSuspenseQueryResult }) => TCombinedResult; + queries: readonly [T extends [] ? [] : T extends [Head] ? [GetUseSuspenseQueryOptions] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryOptions, GetUseSuspenseQueryOptions] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...(...)[]] extends [...] ? [..., ..., ...] : ... extends ... ? ... : ... : unknown[] extends [...Tails[]] ? [...Tails[]] : [...(...)[]] extends ...[] ? ...[] : ...[] : unknown[] extends T ? T : T extends UseSuspenseQueryOptions[] ? UseSuspenseQueryOptions[] : UseSuspenseQueryOptions[]]; +}, queryClient?: QueryClient): TCombinedResult; ``` Defined in: [packages/preact-query/src/useSuspenseQueries.ts:584](https://github.com/TanStack/query/blob/main/packages/preact-query/src/useSuspenseQueries.ts#L584) diff --git a/docs/framework/preact/reference/functions/useSuspenseQuery.md b/docs/framework/preact/reference/functions/useSuspenseQuery.md index 321c1e7b2c5..478f57fad08 100644 --- a/docs/framework/preact/reference/functions/useSuspenseQuery.md +++ b/docs/framework/preact/reference/functions/useSuspenseQuery.md @@ -55,10 +55,10 @@ The [UseSuspenseQueryOptions](../interfaces/UseSuspenseQueryOptions.md) to use | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | -| `queryFn?` | (`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | `skipToken` is not allowed here — Suspense hooks cannot render a "disabled" state, so a query function must always be provided, unless a default query function has been defined. | +| `persister?` | (`queryFn`: (`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `queryFn?` | (`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `TQueryKey`; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | `skipToken` is not allowed here — Suspense hooks cannot render a "disabled" state, so a query function must always be provided, unless a default query function has been defined. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, `TQueryFnData`, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/preact/reference/interfaces/DefaultOptions.md b/docs/framework/preact/reference/interfaces/DefaultOptions.md index 25628a573fb..f26d4b5519c 100644 --- a/docs/framework/preact/reference/interfaces/DefaultOptions.md +++ b/docs/framework/preact/reference/interfaces/DefaultOptions.md @@ -21,7 +21,7 @@ The default options of a `QueryClient`, applied to every query (`queries`), muta | Property | Type | Description | | ------ | ------ | ------ | | `dehydrate?` | [`DehydrateOptions`](DehydrateOptions.md) | Default options used when dehydrating the client's caches; see [DehydrateOptions](DehydrateOptions.md). | -| `hydrate?` | `object` | Default options used when hydrating queries and mutations; see [HydrateOptions](HydrateOptions.md). | +| `hydrate?` | \{ `deserializeData?`: `TransformerFn`; `mutations?`: [`MutationOptions`](MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: [`QueryOptions`](QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \} | Default options used when hydrating queries and mutations; see [HydrateOptions](HydrateOptions.md). | | `hydrate.deserializeData?` | `TransformerFn` | Transforms a query's `data` after it is read from the dehydrated state, reversing `serializeData`. | | `hydrate.mutations?` | [`MutationOptions`](MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\> | Default options merged into every mutation restored from the dehydrated state. | | `hydrate.queries?` | [`QueryOptions`](QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\> | Default options merged into every query restored from the dehydrated state. | diff --git a/docs/framework/preact/reference/interfaces/EnsureQueryDataOptions.md b/docs/framework/preact/reference/interfaces/EnsureQueryDataOptions.md index 489415d5d37..8ab6c8bf8b8 100644 --- a/docs/framework/preact/reference/interfaces/EnsureQueryDataOptions.md +++ b/docs/framework/preact/reference/interfaces/EnsureQueryDataOptions.md @@ -46,10 +46,10 @@ Defined in: [packages/query-core/src/types.ts:774](https://github.com/TanStack/q | ~~`maxPages?`~~ | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | ~~`meta?`~~ | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | ~~`networkMode?`~~ | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | ~~`queryFn?`~~ | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | ~~`queryHash?`~~ | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| ~~`queryKey`~~ | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| ~~`queryKey`~~ | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | ~~`queryKeyHashFn?`~~ | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | ~~`retry?`~~ | \| `number` \| `false` \| `true` \| ((`failureCount`: `number`, `error`: `TError`) => `boolean`) | `undefined` | If `false`, failed queries will not retry by default. If `true`, failed queries will retry infinitely. If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number. If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false. Defaults to `3` on the client and `0` on the server. | | ~~`retryDelay?`~~ | `number` \| ((`failureCount`: `number`, `error`: `TError`) => `number`) | `undefined` | This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. A function like `attempt => attempt * 1000` applies linear backoff. Defaults to a function that applies exponential backoff, capped at 30 seconds. | diff --git a/docs/framework/preact/reference/interfaces/FetchQueryOptions.md b/docs/framework/preact/reference/interfaces/FetchQueryOptions.md index 5a288291ebd..d6fcdc3ef78 100644 --- a/docs/framework/preact/reference/interfaces/FetchQueryOptions.md +++ b/docs/framework/preact/reference/interfaces/FetchQueryOptions.md @@ -50,10 +50,10 @@ Defined in: [packages/query-core/src/types.ts:752](https://github.com/TanStack/q | ~~`maxPages?`~~ | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | ~~`meta?`~~ | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | ~~`networkMode?`~~ | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | ~~`queryFn?`~~ | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | ~~`queryHash?`~~ | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| ~~`queryKey`~~ | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| ~~`queryKey`~~ | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | ~~`queryKeyHashFn?`~~ | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | ~~`retry?`~~ | \| `number` \| `false` \| `true` \| ((`failureCount`: `number`, `error`: `TError`) => `boolean`) | `undefined` | If `false`, failed queries will not retry by default. If `true`, failed queries will retry infinitely. If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number. If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false. Defaults to `3` on the client and `0` on the server. | | ~~`retryDelay?`~~ | `number` \| ((`failureCount`: `number`, `error`: `TError`) => `number`) | `undefined` | This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. A function like `attempt => attempt * 1000` applies linear backoff. Defaults to a function that applies exponential backoff, capped at 30 seconds. | diff --git a/docs/framework/preact/reference/interfaces/HydrateOptions.md b/docs/framework/preact/reference/interfaces/HydrateOptions.md index f070f729ff9..1dd5de960ae 100644 --- a/docs/framework/preact/reference/interfaces/HydrateOptions.md +++ b/docs/framework/preact/reference/interfaces/HydrateOptions.md @@ -14,7 +14,7 @@ Options for `hydrate`, controlling the default options applied to queries/mutati | Property | Type | Description | | ------ | ------ | ------ | -| `defaultOptions?` | `object` | Options applied to the queries and mutations restored from the dehydrated state. | +| `defaultOptions?` | \{ `deserializeData?`: `TransformerFn`; `mutations?`: [`MutationOptions`](MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: [`QueryOptions`](QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \} | Options applied to the queries and mutations restored from the dehydrated state. | | `defaultOptions.deserializeData?` | `TransformerFn` | Transforms a query's `data` after it is read from the dehydrated state, reversing `serializeData`. | | `defaultOptions.mutations?` | [`MutationOptions`](MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\> | Default options merged into every mutation restored from the dehydrated state. | | `defaultOptions.queries?` | [`QueryOptions`](QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\> | Default options merged into every query restored from the dehydrated state. | diff --git a/docs/framework/preact/reference/interfaces/HydrationBoundaryProps.md b/docs/framework/preact/reference/interfaces/HydrationBoundaryProps.md index 019ca6f3c85..5dfc5088599 100644 --- a/docs/framework/preact/reference/interfaces/HydrationBoundaryProps.md +++ b/docs/framework/preact/reference/interfaces/HydrationBoundaryProps.md @@ -14,6 +14,6 @@ The props accepted by `HydrationBoundary`. | Property | Type | Description | | ------ | ------ | ------ | | `children?` | `ComponentChildren` | The components to render — always rendered unconditionally, not gated on hydration. New queries are hydrated into the cache during render; for queries that already exist in the cache, only newer dehydrated data is hydrated, and that happens in an effect after commit, so `children` may render briefly before it lands. | -| `options?` | [`OmitKeyof`](../type-aliases/OmitKeyof.md)\<[`HydrateOptions`](HydrateOptions.md), `"defaultOptions"`\> & `object` | Optional. Note: unlike `hydrate`, `mutations` cannot be set here. | +| `options?` | [`OmitKeyof`](../type-aliases/OmitKeyof.md)\<[`HydrateOptions`](HydrateOptions.md), `"defaultOptions"`\> & \{ `defaultOptions?`: [`OmitKeyof`](../type-aliases/OmitKeyof.md)\<\{ `deserializeData?`: `TransformerFn`; `mutations?`: [`MutationOptions`](MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: [`QueryOptions`](QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \}, `"mutations"`\>; \} | Optional. Note: unlike `hydrate`, `mutations` cannot be set here. | | `queryClient?` | [`QueryClient`](../classes/QueryClient.md) | Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. | | `state` | [`DehydratedState`](DehydratedState.md) \| `null` \| `undefined` | The state to hydrate. | diff --git a/docs/framework/preact/reference/interfaces/InfiniteQueryObserverOptions.md b/docs/framework/preact/reference/interfaces/InfiniteQueryObserverOptions.md index 418e3d41ebf..c8cbb098e8a 100644 --- a/docs/framework/preact/reference/interfaces/InfiniteQueryObserverOptions.md +++ b/docs/framework/preact/reference/interfaces/InfiniteQueryObserverOptions.md @@ -52,11 +52,11 @@ The options of an `InfiniteQueryObserver`: [QueryObserverOptions](QueryObserverO | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| ((`previousData`: \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<[`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TError`, [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\> \| `undefined`) => \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/preact/reference/interfaces/QueryExecuteOptions.md b/docs/framework/preact/reference/interfaces/QueryExecuteOptions.md index a14c79bfc19..0f472791f1e 100644 --- a/docs/framework/preact/reference/interfaces/QueryExecuteOptions.md +++ b/docs/framework/preact/reference/interfaces/QueryExecuteOptions.md @@ -52,10 +52,10 @@ transforms the value the call resolves with. | `maxPages?` | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `retry?` | \| `number` \| `false` \| `true` \| ((`failureCount`: `number`, `error`: `TError`) => `boolean`) | `undefined` | If `false`, failed queries will not retry by default. If `true`, failed queries will retry infinitely. If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number. If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false. Defaults to `3` on the client and `0` on the server. | | `retryDelay?` | `number` \| ((`failureCount`: `number`, `error`: `TError`) => `number`) | `undefined` | This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. A function like `attempt => attempt * 1000` applies linear backoff. Defaults to a function that applies exponential backoff, capped at 30 seconds. | diff --git a/docs/framework/preact/reference/interfaces/QueryObserverOptions.md b/docs/framework/preact/reference/interfaces/QueryObserverOptions.md index 4825f4dad77..c7192281329 100644 --- a/docs/framework/preact/reference/interfaces/QueryObserverOptions.md +++ b/docs/framework/preact/reference/interfaces/QueryObserverOptions.md @@ -58,11 +58,11 @@ The options of a `QueryObserver`, and of the hooks built on it like `useQuery`: | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| `NonFunctionGuard`\<`TQueryData`\> \| ((`previousData`: `NonFunctionGuard`\<`TQueryData`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<`NonFunctionGuard`\<`TQueryData`\>, `TError`, `NonFunctionGuard`\<`TQueryData`\>, `TQueryKey`\> \| `undefined`) => `NonFunctionGuard`\<`TQueryData`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, `TQueryData`, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/preact/reference/interfaces/QueryOptions.md b/docs/framework/preact/reference/interfaces/QueryOptions.md index 574f08b670a..72c9a70ab0e 100644 --- a/docs/framework/preact/reference/interfaces/QueryOptions.md +++ b/docs/framework/preact/reference/interfaces/QueryOptions.md @@ -42,7 +42,7 @@ The options of a query itself — its `queryKey`, `queryFn`, retries, `gcTime`, | `maxPages?` | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `queryFn?` | \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) \| *typeof* [`skipToken`](../variables/skipToken.md) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | | `queryKey?` | `TQueryKey` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | diff --git a/docs/framework/preact/reference/interfaces/UseBaseQueryOptions.md b/docs/framework/preact/reference/interfaces/UseBaseQueryOptions.md index 6447a407893..41db7707b6a 100644 --- a/docs/framework/preact/reference/interfaces/UseBaseQueryOptions.md +++ b/docs/framework/preact/reference/interfaces/UseBaseQueryOptions.md @@ -60,11 +60,11 @@ The type of your `queryKey`. | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| `NonFunctionGuard`\<`TQueryData`\> \| ((`previousData`: `NonFunctionGuard`\<`TQueryData`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<`NonFunctionGuard`\<`TQueryData`\>, `TError`, `NonFunctionGuard`\<`TQueryData`\>, `TQueryKey`\> \| `undefined`) => `NonFunctionGuard`\<`TQueryData`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | -| `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | +| `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `TQueryKey`; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, `TQueryData`, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/preact/reference/interfaces/UseInfiniteQueryOptions.md b/docs/framework/preact/reference/interfaces/UseInfiniteQueryOptions.md index c70eadbc9f5..95b58eee86f 100644 --- a/docs/framework/preact/reference/interfaces/UseInfiniteQueryOptions.md +++ b/docs/framework/preact/reference/interfaces/UseInfiniteQueryOptions.md @@ -63,11 +63,11 @@ The type of the parameter passed to `queryFn` to fetch a given page. | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| ((`previousData`: \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<[`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TError`, [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\> \| `undefined`) => \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/preact/reference/interfaces/UseQueryOptions.md b/docs/framework/preact/reference/interfaces/UseQueryOptions.md index 134c906c68c..774a39d9ad3 100644 --- a/docs/framework/preact/reference/interfaces/UseQueryOptions.md +++ b/docs/framework/preact/reference/interfaces/UseQueryOptions.md @@ -53,11 +53,11 @@ The type of your `queryKey`. | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| `NonFunctionGuard`\<`TQueryFnData`\> \| ((`previousData`: `NonFunctionGuard`\<`TQueryFnData`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<`NonFunctionGuard`\<`TQueryFnData`\>, `TError`, `NonFunctionGuard`\<`TQueryFnData`\>, `TQueryKey`\> \| `undefined`) => `NonFunctionGuard`\<`TQueryFnData`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | -| `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | +| `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `TQueryKey`; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, `TQueryFnData`, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/preact/reference/interfaces/UseSuspenseInfiniteQueryOptions.md b/docs/framework/preact/reference/interfaces/UseSuspenseInfiniteQueryOptions.md index 845f9d6a576..35da44b67d0 100644 --- a/docs/framework/preact/reference/interfaces/UseSuspenseInfiniteQueryOptions.md +++ b/docs/framework/preact/reference/interfaces/UseSuspenseInfiniteQueryOptions.md @@ -62,10 +62,10 @@ The type of the parameter passed to `queryFn` to fetch a given page. | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `queryFn?` | (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | `skipToken` is not allowed here — Suspense hooks cannot render a "disabled" state, so a query function must always be provided, unless a default query function has been defined. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/preact/reference/interfaces/UseSuspenseQueryOptions.md b/docs/framework/preact/reference/interfaces/UseSuspenseQueryOptions.md index 4b36b7f0eb2..c9672f0feed 100644 --- a/docs/framework/preact/reference/interfaces/UseSuspenseQueryOptions.md +++ b/docs/framework/preact/reference/interfaces/UseSuspenseQueryOptions.md @@ -53,10 +53,10 @@ The type of your `queryKey`. | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | -| `queryFn?` | (`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | `skipToken` is not allowed here — Suspense hooks cannot render a "disabled" state, so a query function must always be provided, unless a default query function has been defined. | +| `persister?` | (`queryFn`: (`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `queryFn?` | (`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `TQueryKey`; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | `skipToken` is not allowed here — Suspense hooks cannot render a "disabled" state, so a query function must always be provided, unless a default query function has been defined. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, `TQueryFnData`, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/preact/reference/type-aliases/AnyDataTag.md b/docs/framework/preact/reference/type-aliases/AnyDataTag.md index 4b9304ed2ee..65d582ac8aa 100644 --- a/docs/framework/preact/reference/type-aliases/AnyDataTag.md +++ b/docs/framework/preact/reference/type-aliases/AnyDataTag.md @@ -6,7 +6,10 @@ title: AnyDataTag ```ts -type AnyDataTag = object; +type AnyDataTag = { + [dataTagErrorSymbol]: any; + [dataTagSymbol]: any; +}; ``` Defined in: [packages/query-core/src/types.ts:122](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L122) diff --git a/docs/framework/preact/reference/type-aliases/DataTag.md b/docs/framework/preact/reference/type-aliases/DataTag.md index 6e5cbfd46b9..22389c45a62 100644 --- a/docs/framework/preact/reference/type-aliases/DataTag.md +++ b/docs/framework/preact/reference/type-aliases/DataTag.md @@ -6,7 +6,10 @@ title: DataTag ```ts -type DataTag = TType extends AnyDataTag ? TType : TType & object; +type DataTag = TType extends AnyDataTag ? TType : TType & { + [dataTagErrorSymbol]: TError; + [dataTagSymbol]: TValue; +}; ``` Defined in: [packages/query-core/src/types.ts:137](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L137) diff --git a/docs/framework/preact/reference/type-aliases/DefaultError.md b/docs/framework/preact/reference/type-aliases/DefaultError.md index 85150115168..1db2fd40ed7 100644 --- a/docs/framework/preact/reference/type-aliases/DefaultError.md +++ b/docs/framework/preact/reference/type-aliases/DefaultError.md @@ -6,7 +6,9 @@ title: DefaultError ```ts -type DefaultError = Register extends object ? TError : Error; +type DefaultError = Register extends { + defaultError: infer TError; +} ? TError : Error; ``` Defined in: [packages/query-core/src/types.ts:83](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L83) diff --git a/docs/framework/preact/reference/type-aliases/DefinedInitialDataInfiniteOptions.md b/docs/framework/preact/reference/type-aliases/DefinedInitialDataInfiniteOptions.md index ab6e6b1ec6a..dec277186b9 100644 --- a/docs/framework/preact/reference/type-aliases/DefinedInitialDataInfiniteOptions.md +++ b/docs/framework/preact/reference/type-aliases/DefinedInitialDataInfiniteOptions.md @@ -6,7 +6,11 @@ title: DefinedInitialDataInfiniteOptions ```ts -type DefinedInitialDataInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions & object; +type DefinedInitialDataInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions & { + initialData: | NonUndefinedGuard> + | (() => NonUndefinedGuard>) + | undefined; +}; ``` Defined in: [packages/preact-query/src/infiniteQueryOptions.ts:101](https://github.com/TanStack/query/blob/main/packages/preact-query/src/infiniteQueryOptions.ts#L101) diff --git a/docs/framework/preact/reference/type-aliases/DefinedInitialDataOptions.md b/docs/framework/preact/reference/type-aliases/DefinedInitialDataOptions.md index 7eaa167e97e..f302d02ffc0 100644 --- a/docs/framework/preact/reference/type-aliases/DefinedInitialDataOptions.md +++ b/docs/framework/preact/reference/type-aliases/DefinedInitialDataOptions.md @@ -6,7 +6,11 @@ title: DefinedInitialDataOptions ```ts -type DefinedInitialDataOptions = Omit, "queryFn"> & object; +type DefinedInitialDataOptions = Omit, "queryFn"> & { + initialData: | NonUndefinedGuard + | (() => NonUndefinedGuard); + queryFn?: QueryFunction; +}; ``` Defined in: [packages/preact-query/src/queryOptions.ts:78](https://github.com/TanStack/query/blob/main/packages/preact-query/src/queryOptions.ts#L78) diff --git a/docs/framework/preact/reference/type-aliases/EnsureInfiniteQueryDataOptions.md b/docs/framework/preact/reference/type-aliases/EnsureInfiniteQueryDataOptions.md index 1142c9bf005..d9c876a6029 100644 --- a/docs/framework/preact/reference/type-aliases/EnsureInfiniteQueryDataOptions.md +++ b/docs/framework/preact/reference/type-aliases/EnsureInfiniteQueryDataOptions.md @@ -6,7 +6,9 @@ title: EnsureInfiniteQueryDataOptions ```ts -type EnsureInfiniteQueryDataOptions = FetchInfiniteQueryOptions & object; +type EnsureInfiniteQueryDataOptions = FetchInfiniteQueryOptions & { + revalidateIfStale?: boolean; +}; ``` Defined in: [packages/query-core/src/types.ts:794](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L794) diff --git a/docs/framework/preact/reference/type-aliases/MutationFunctionContext.md b/docs/framework/preact/reference/type-aliases/MutationFunctionContext.md index 39a5d19316a..4b2d040ca9a 100644 --- a/docs/framework/preact/reference/type-aliases/MutationFunctionContext.md +++ b/docs/framework/preact/reference/type-aliases/MutationFunctionContext.md @@ -6,7 +6,11 @@ title: MutationFunctionContext ```ts -type MutationFunctionContext = object; +type MutationFunctionContext = { + client: QueryClient; + meta: MutationMeta | undefined; + mutationKey?: MutationKey; +}; ``` Defined in: [packages/query-core/src/types.ts:1855](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1855) diff --git a/docs/framework/preact/reference/type-aliases/MutationKey.md b/docs/framework/preact/reference/type-aliases/MutationKey.md index 7c598833c16..372431c32fb 100644 --- a/docs/framework/preact/reference/type-aliases/MutationKey.md +++ b/docs/framework/preact/reference/type-aliases/MutationKey.md @@ -6,7 +6,9 @@ title: MutationKey ```ts -type MutationKey = Register extends object ? TMutationKey extends ReadonlyArray ? TMutationKey : TMutationKey extends unknown[] ? TMutationKey : ReadonlyArray : ReadonlyArray; +type MutationKey = Register extends { + mutationKey: infer TMutationKey; +} ? TMutationKey extends ReadonlyArray ? TMutationKey : TMutationKey extends unknown[] ? TMutationKey : ReadonlyArray : ReadonlyArray; ``` Defined in: [packages/query-core/src/types.ts:1814](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1814) diff --git a/docs/framework/preact/reference/type-aliases/MutationMeta.md b/docs/framework/preact/reference/type-aliases/MutationMeta.md index 2b7dc7446ae..ddac47dcfc4 100644 --- a/docs/framework/preact/reference/type-aliases/MutationMeta.md +++ b/docs/framework/preact/reference/type-aliases/MutationMeta.md @@ -6,7 +6,9 @@ title: MutationMeta ```ts -type MutationMeta = Register extends object ? TMutationMeta extends Record ? TMutationMeta : Record : Record; +type MutationMeta = Register extends { + mutationMeta: infer TMutationMeta; +} ? TMutationMeta extends Record ? TMutationMeta : Record : Record; ``` Defined in: [packages/query-core/src/types.ts:1843](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1843) diff --git a/docs/framework/preact/reference/type-aliases/MutationScope.md b/docs/framework/preact/reference/type-aliases/MutationScope.md index 4357b2d629d..f859dc913a9 100644 --- a/docs/framework/preact/reference/type-aliases/MutationScope.md +++ b/docs/framework/preact/reference/type-aliases/MutationScope.md @@ -6,7 +6,9 @@ title: MutationScope ```ts -type MutationScope = object; +type MutationScope = { + id: string; +}; ``` Defined in: [packages/query-core/src/types.ts:1832](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1832) diff --git a/docs/framework/preact/reference/type-aliases/QueryClientProviderProps.md b/docs/framework/preact/reference/type-aliases/QueryClientProviderProps.md index ee1b51a8074..47e513ae3c2 100644 --- a/docs/framework/preact/reference/type-aliases/QueryClientProviderProps.md +++ b/docs/framework/preact/reference/type-aliases/QueryClientProviderProps.md @@ -6,7 +6,10 @@ title: QueryClientProviderProps ```ts -type QueryClientProviderProps = object; +type QueryClientProviderProps = { + children?: ComponentChildren; + client: QueryClient; +}; ``` Defined in: [packages/preact-query/src/QueryClientProvider.tsx:38](https://github.com/TanStack/query/blob/main/packages/preact-query/src/QueryClientProvider.tsx#L38) diff --git a/docs/framework/preact/reference/type-aliases/QueryFunctionContext.md b/docs/framework/preact/reference/type-aliases/QueryFunctionContext.md index 15a8d2e9261..59324fb3aeb 100644 --- a/docs/framework/preact/reference/type-aliases/QueryFunctionContext.md +++ b/docs/framework/preact/reference/type-aliases/QueryFunctionContext.md @@ -6,7 +6,21 @@ title: QueryFunctionContext ```ts -type QueryFunctionContext = [TPageParam] extends [never] ? object : object; +type QueryFunctionContext = [TPageParam] extends [never] ? { + client: QueryClient; + direction?: unknown; + meta: QueryMeta | undefined; + pageParam?: unknown; + queryKey: TQueryKey; + signal: AbortSignal; +} : { + client: QueryClient; + direction: FetchDirection; + meta: QueryMeta | undefined; + pageParam: TPageParam; + queryKey: TQueryKey; + signal: AbortSignal; +}; ``` Defined in: [packages/query-core/src/types.ts:235](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L235) diff --git a/docs/framework/preact/reference/type-aliases/QueryKey.md b/docs/framework/preact/reference/type-aliases/QueryKey.md index 6a2c8ca5503..d358486f29b 100644 --- a/docs/framework/preact/reference/type-aliases/QueryKey.md +++ b/docs/framework/preact/reference/type-aliases/QueryKey.md @@ -6,7 +6,9 @@ title: QueryKey ```ts -type QueryKey = Register extends object ? TQueryKey extends ReadonlyArray ? TQueryKey : TQueryKey extends unknown[] ? TQueryKey : ReadonlyArray : ReadonlyArray; +type QueryKey = Register extends { + queryKey: infer TQueryKey; +} ? TQueryKey extends ReadonlyArray ? TQueryKey : TQueryKey extends unknown[] ? TQueryKey : ReadonlyArray : ReadonlyArray; ``` Defined in: [packages/query-core/src/types.ts:93](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L93) diff --git a/docs/framework/preact/reference/type-aliases/QueryKeyWithDataTag.md b/docs/framework/preact/reference/type-aliases/QueryKeyWithDataTag.md index 60244136ec1..f4c0ab86c9a 100644 --- a/docs/framework/preact/reference/type-aliases/QueryKeyWithDataTag.md +++ b/docs/framework/preact/reference/type-aliases/QueryKeyWithDataTag.md @@ -6,7 +6,9 @@ title: QueryKeyWithDataTag ```ts -type QueryKeyWithDataTag = object; +type QueryKeyWithDataTag = { + queryKey: DataTag; +}; ``` Defined in: [packages/query-core/src/types.ts:152](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L152) diff --git a/docs/framework/preact/reference/type-aliases/QueryMeta.md b/docs/framework/preact/reference/type-aliases/QueryMeta.md index 3df2e5a17bd..6f1b27a3d9e 100644 --- a/docs/framework/preact/reference/type-aliases/QueryMeta.md +++ b/docs/framework/preact/reference/type-aliases/QueryMeta.md @@ -6,7 +6,9 @@ title: QueryMeta ```ts -type QueryMeta = Register extends object ? TQueryMeta extends Record ? TQueryMeta : Record : Record; +type QueryMeta = Register extends { + queryMeta: infer TQueryMeta; +} ? TQueryMeta extends Record ? TQueryMeta : Record : Record; ``` Defined in: [packages/query-core/src/types.ts:330](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L330) diff --git a/docs/framework/preact/reference/type-aliases/TimeoutProvider.md b/docs/framework/preact/reference/type-aliases/TimeoutProvider.md index 6e3fd194540..88cd72aa7e3 100644 --- a/docs/framework/preact/reference/type-aliases/TimeoutProvider.md +++ b/docs/framework/preact/reference/type-aliases/TimeoutProvider.md @@ -6,7 +6,12 @@ title: TimeoutProvider ```ts -type TimeoutProvider = object; +type TimeoutProvider = { + clearInterval: (intervalId: TTimerId | undefined) => void; + clearTimeout: (timeoutId: TTimerId | undefined) => void; + setInterval: (callback: TimeoutCallback, delay: number) => TTimerId; + setTimeout: (callback: TimeoutCallback, delay: number) => TTimerId; +}; ``` Defined in: [packages/query-core/src/timeoutManager.ts:28](https://github.com/TanStack/query/blob/main/packages/query-core/src/timeoutManager.ts#L28) diff --git a/docs/framework/preact/reference/type-aliases/UndefinedInitialDataInfiniteOptions.md b/docs/framework/preact/reference/type-aliases/UndefinedInitialDataInfiniteOptions.md index ec82fc56d40..31392ef8497 100644 --- a/docs/framework/preact/reference/type-aliases/UndefinedInitialDataInfiniteOptions.md +++ b/docs/framework/preact/reference/type-aliases/UndefinedInitialDataInfiniteOptions.md @@ -6,7 +6,10 @@ title: UndefinedInitialDataInfiniteOptions ```ts -type UndefinedInitialDataInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions & object; +type UndefinedInitialDataInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions & { + initialData?: | NonUndefinedGuard> + | InitialDataFunction>>; +}; ``` Defined in: [packages/preact-query/src/infiniteQueryOptions.ts:24](https://github.com/TanStack/query/blob/main/packages/preact-query/src/infiniteQueryOptions.ts#L24) diff --git a/docs/framework/preact/reference/type-aliases/UndefinedInitialDataOptions.md b/docs/framework/preact/reference/type-aliases/UndefinedInitialDataOptions.md index 7715aaab84c..a7442d483e7 100644 --- a/docs/framework/preact/reference/type-aliases/UndefinedInitialDataOptions.md +++ b/docs/framework/preact/reference/type-aliases/UndefinedInitialDataOptions.md @@ -6,7 +6,10 @@ title: UndefinedInitialDataOptions ```ts -type UndefinedInitialDataOptions = UseQueryOptions & object; +type UndefinedInitialDataOptions = UseQueryOptions & { + initialData?: | InitialDataFunction> + | NonUndefinedGuard; +}; ``` Defined in: [packages/preact-query/src/queryOptions.ts:22](https://github.com/TanStack/query/blob/main/packages/preact-query/src/queryOptions.ts#L22) diff --git a/docs/framework/preact/reference/type-aliases/UnusedSkipTokenInfiniteOptions.md b/docs/framework/preact/reference/type-aliases/UnusedSkipTokenInfiniteOptions.md index 9fa36591147..37b7b1b8912 100644 --- a/docs/framework/preact/reference/type-aliases/UnusedSkipTokenInfiniteOptions.md +++ b/docs/framework/preact/reference/type-aliases/UnusedSkipTokenInfiniteOptions.md @@ -6,7 +6,9 @@ title: UnusedSkipTokenInfiniteOptions ```ts -type UnusedSkipTokenInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = OmitKeyof, "queryFn"> & object; +type UnusedSkipTokenInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = OmitKeyof, "queryFn"> & { + queryFn?: Exclude["queryFn"], SkipToken | undefined>; +}; ``` Defined in: [packages/preact-query/src/infiniteQueryOptions.ts:63](https://github.com/TanStack/query/blob/main/packages/preact-query/src/infiniteQueryOptions.ts#L63) diff --git a/docs/framework/preact/reference/type-aliases/UnusedSkipTokenOptions.md b/docs/framework/preact/reference/type-aliases/UnusedSkipTokenOptions.md index 73a9bd8febb..28a8a53673d 100644 --- a/docs/framework/preact/reference/type-aliases/UnusedSkipTokenOptions.md +++ b/docs/framework/preact/reference/type-aliases/UnusedSkipTokenOptions.md @@ -6,7 +6,9 @@ title: UnusedSkipTokenOptions ```ts -type UnusedSkipTokenOptions = OmitKeyof, "queryFn"> & object; +type UnusedSkipTokenOptions = OmitKeyof, "queryFn"> & { + queryFn?: Exclude["queryFn"], SkipToken | undefined>; +}; ``` Defined in: [packages/preact-query/src/queryOptions.ts:49](https://github.com/TanStack/query/blob/main/packages/preact-query/src/queryOptions.ts#L49) diff --git a/docs/framework/preact/reference/type-aliases/UseBaseMutationResult.md b/docs/framework/preact/reference/type-aliases/UseBaseMutationResult.md index 1e822bd0f73..c1f7ef8832d 100644 --- a/docs/framework/preact/reference/type-aliases/UseBaseMutationResult.md +++ b/docs/framework/preact/reference/type-aliases/UseBaseMutationResult.md @@ -8,7 +8,9 @@ title: UseBaseMutationResult ```ts type UseBaseMutationResult = Override, { mutate: UseMutateFunction; -}> & object; +}> & { + mutateAsync: UseMutateAsyncFunction; +}; ``` Defined in: [packages/preact-query/src/types.ts:452](https://github.com/TanStack/query/blob/main/packages/preact-query/src/types.ts#L452) diff --git a/docs/framework/preact/reference/type-aliases/UsePrefetchInfiniteQueryOptions.md b/docs/framework/preact/reference/type-aliases/UsePrefetchInfiniteQueryOptions.md index fd2ee74d6ca..770b772bd8e 100644 --- a/docs/framework/preact/reference/type-aliases/UsePrefetchInfiniteQueryOptions.md +++ b/docs/framework/preact/reference/type-aliases/UsePrefetchInfiniteQueryOptions.md @@ -6,7 +6,9 @@ title: UsePrefetchInfiniteQueryOptions ```ts -type UsePrefetchInfiniteQueryOptions = DistributiveOmit, "queryFn"> & object; +type UsePrefetchInfiniteQueryOptions = DistributiveOmit, "queryFn"> & { + queryFn?: Exclude["queryFn"], SkipToken>; +}; ``` Defined in: [packages/preact-query/src/types.ts:113](https://github.com/TanStack/query/blob/main/packages/preact-query/src/types.ts#L113) diff --git a/docs/framework/preact/reference/type-aliases/UsePrefetchQueryOptions.md b/docs/framework/preact/reference/type-aliases/UsePrefetchQueryOptions.md index d94282302d9..9ff92a7ee2b 100644 --- a/docs/framework/preact/reference/type-aliases/UsePrefetchQueryOptions.md +++ b/docs/framework/preact/reference/type-aliases/UsePrefetchQueryOptions.md @@ -6,7 +6,9 @@ title: UsePrefetchQueryOptions ```ts -type UsePrefetchQueryOptions = DistributiveOmit, "queryFn"> & object; +type UsePrefetchQueryOptions = DistributiveOmit, "queryFn"> & { + queryFn?: Exclude["queryFn"], SkipToken>; +}; ``` Defined in: [packages/preact-query/src/types.ts:76](https://github.com/TanStack/query/blob/main/packages/preact-query/src/types.ts#L76) diff --git a/docs/framework/preact/reference/variables/environmentManager.md b/docs/framework/preact/reference/variables/environmentManager.md index 40b82d3a2de..4e8224270d3 100644 --- a/docs/framework/preact/reference/variables/environmentManager.md +++ b/docs/framework/preact/reference/variables/environmentManager.md @@ -6,7 +6,10 @@ title: environmentManager ```ts -const environmentManager: object; +const environmentManager: { + isServer: () => boolean; + setIsServer(isServerValue: IsServerValue): void; +}; ``` Defined in: [packages/query-core/src/environmentManager.ts:32](https://github.com/TanStack/query/blob/main/packages/query-core/src/environmentManager.ts#L32) diff --git a/docs/framework/preact/reference/variables/notifyManager.md b/docs/framework/preact/reference/variables/notifyManager.md index 82290f7f19a..5ddda37894d 100644 --- a/docs/framework/preact/reference/variables/notifyManager.md +++ b/docs/framework/preact/reference/variables/notifyManager.md @@ -6,7 +6,14 @@ title: notifyManager ```ts -const notifyManager: object; +const notifyManager: { + batch: (callback: () => T) => T; + batchCalls: (callback: BatchCallsCallback) => BatchCallsCallback; + schedule: (callback: NotifyCallback) => void; + setBatchNotifyFunction: (fn: BatchNotifyFunction) => void; + setNotifyFunction: (fn: NotifyFunction) => void; + setScheduler: (fn: ScheduleFunction) => void; +}; ``` Defined in: [packages/query-core/src/notifyManager.ts:154](https://github.com/TanStack/query/blob/main/packages/query-core/src/notifyManager.ts#L154) diff --git a/docs/framework/react/reference/functions/HydrationBoundary.md b/docs/framework/react/reference/functions/HydrationBoundary.md index 9ba54f7fa03..27c3cffb2cd 100644 --- a/docs/framework/react/reference/functions/HydrationBoundary.md +++ b/docs/framework/react/reference/functions/HydrationBoundary.md @@ -33,7 +33,7 @@ The dehydrated `state` to hydrate, the hydrate `options`, an optional custom | Property | Type | Description | | ------ | ------ | ------ | | `children?` | `ReactNode` | The components to render — always rendered unconditionally, not gated on hydration. New queries are hydrated into the cache during render; for queries that already exist in the cache, only newer dehydrated data is hydrated, and that happens in an effect after commit, so `children` may render briefly before it lands. | -| `options?` | [`OmitKeyof`](../type-aliases/OmitKeyof.md)\<[`HydrateOptions`](../interfaces/HydrateOptions.md), `"defaultOptions"`\> & `object` | Optional. Note: unlike `hydrate`, `mutations` cannot be set here. | +| `options?` | [`OmitKeyof`](../type-aliases/OmitKeyof.md)\<[`HydrateOptions`](../interfaces/HydrateOptions.md), `"defaultOptions"`\> & \{ `defaultOptions?`: [`OmitKeyof`](../type-aliases/OmitKeyof.md)\<\{ `deserializeData?`: `TransformerFn`; `mutations?`: [`MutationOptions`](../interfaces/MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: [`QueryOptions`](../interfaces/QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \}, `"mutations"`\>; \} | Optional. Note: unlike `hydrate`, `mutations` cannot be set here. | | `queryClient?` | [`QueryClient`](../classes/QueryClient.md) | Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. | | `state` | [`DehydratedState`](../interfaces/DehydratedState.md) \| `null` \| `undefined` | The state to hydrate. | diff --git a/docs/framework/react/reference/functions/experimental_streamedQuery.md b/docs/framework/react/reference/functions/experimental_streamedQuery.md index fe494c89bfc..160e9ef9332 100644 --- a/docs/framework/react/reference/functions/experimental_streamedQuery.md +++ b/docs/framework/react/reference/functions/experimental_streamedQuery.md @@ -8,7 +8,14 @@ redirect_from: ```ts -function experimental_streamedQuery(options: StreamedQueryParams): (context: object) => TData | Promise; +function experimental_streamedQuery(options: StreamedQueryParams): (context: { + client: QueryClient; + direction?: unknown; + meta: Record | undefined; + pageParam?: unknown; + queryKey: TQueryKey; + signal: AbortSignal; +}) => TData | Promise; ``` Defined in: [packages/query-core/src/streamedQuery.ts:70](https://github.com/TanStack/query/blob/main/packages/query-core/src/streamedQuery.ts#L70) @@ -45,7 +52,14 @@ The `streamFn` that returns an AsyncIterable to stream data from, and the option A query function to pass as `queryFn`. -(`context`: `object`) => `TData` \| `Promise`\<`TData`\> +(`context`: \{ + `client`: [`QueryClient`](../classes/QueryClient.md); + `direction?`: `unknown`; + `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; + `pageParam?`: `unknown`; + `queryKey`: `TQueryKey`; + `signal`: `AbortSignal`; +\}) => `TData` \| `Promise`\<`TData`\> ## Example diff --git a/docs/framework/react/reference/functions/hydrate.md b/docs/framework/react/reference/functions/hydrate.md index 411978a70f8..aa8ca8ffd6e 100644 --- a/docs/framework/react/reference/functions/hydrate.md +++ b/docs/framework/react/reference/functions/hydrate.md @@ -56,7 +56,7 @@ client's `defaultOptions.hydrate`), and `deserializeData` to reverse `serializeD | Property | Type | Description | | ------ | ------ | ------ | -| `defaultOptions?` | `object` | Options applied to the queries and mutations restored from the dehydrated state. | +| `defaultOptions?` | \{ `deserializeData?`: `TransformerFn`; `mutations?`: [`MutationOptions`](../interfaces/MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: [`QueryOptions`](../interfaces/QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \} | Options applied to the queries and mutations restored from the dehydrated state. | | `defaultOptions.deserializeData?` | `TransformerFn` | Transforms a query's `data` after it is read from the dehydrated state, reversing `serializeData`. | | `defaultOptions.mutations?` | [`MutationOptions`](../interfaces/MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\> | Default options merged into every mutation restored from the dehydrated state. | | `defaultOptions.queries?` | [`QueryOptions`](../interfaces/QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\> | Default options merged into every query restored from the dehydrated state. | diff --git a/docs/framework/react/reference/functions/useInfiniteQuery.md b/docs/framework/react/reference/functions/useInfiniteQuery.md index ee9b36d009b..3f5bbcc5f8a 100644 --- a/docs/framework/react/reference/functions/useInfiniteQuery.md +++ b/docs/framework/react/reference/functions/useInfiniteQuery.md @@ -499,11 +499,11 @@ The [UseInfiniteQueryOptions](../interfaces/UseInfiniteQueryOptions.md) to use | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| ((`previousData`: \| [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<[`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TError`, [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\> \| `undefined`) => \| [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/react/reference/functions/useQueries.md b/docs/framework/react/reference/functions/useQueries.md index 2935184aaac..3182711dece 100644 --- a/docs/framework/react/reference/functions/useQueries.md +++ b/docs/framework/react/reference/functions/useQueries.md @@ -8,7 +8,12 @@ redirect_from: ```ts -function useQueries] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseQueryResult, GetUseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseQueryResult, GetUseQueryResult, GetUseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : [...{ [K in string | number | symbol]: GetUseQueryResult }[]] : { [K in string | number | symbol]: GetUseQueryResult }>(options: object, queryClient?: QueryClient): TCombinedResult; +function useQueries] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseQueryResult, GetUseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseQueryResult, GetUseQueryResult, GetUseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : [...{ [K in string | number | symbol]: GetUseQueryResult }[]] : { [K in string | number | symbol]: GetUseQueryResult }>(options: { + combine?: (result: T extends [] ? [] : T extends [Head] ? [GetUseQueryResult] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseQueryResult, GetUseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : { [K in string | number | symbol]: GetUseQueryResult }) => TCombinedResult; + queries: | readonly [T extends [] ? [] : T extends [Head] ? [GetUseQueryOptionsForUseQueries] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseQueryOptionsForUseQueries, GetUseQueryOptionsForUseQueries] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : readonly ...[] extends [...(...)[]] ? [...(...)[]] : ... extends ... ? ... : ... : readonly unknown[] extends T ? T : T extends UseQueryOptionsForUseQueries[] ? UseQueryOptionsForUseQueries[] : UseQueryOptionsForUseQueries[]] + | readonly [{ [K in string | number | symbol]: GetUseQueryOptionsForUseQueries }]; + subscribed?: boolean; +}, queryClient?: QueryClient): TCombinedResult; ``` Defined in: [packages/react-query/src/useQueries.ts:356](https://github.com/TanStack/query/blob/main/packages/react-query/src/useQueries.ts#L356) diff --git a/docs/framework/react/reference/functions/useQuery.md b/docs/framework/react/reference/functions/useQuery.md index e1d8a65f171..2fe617b98e3 100644 --- a/docs/framework/react/reference/functions/useQuery.md +++ b/docs/framework/react/reference/functions/useQuery.md @@ -438,11 +438,11 @@ The [UseQueryOptions](../interfaces/UseQueryOptions.md) to use — everything yo | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| `NonFunctionGuard`\<`TQueryFnData`\> \| ((`previousData`: `NonFunctionGuard`\<`TQueryFnData`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<`NonFunctionGuard`\<`TQueryFnData`\>, `TError`, `NonFunctionGuard`\<`TQueryFnData`\>, `TQueryKey`\> \| `undefined`) => `NonFunctionGuard`\<`TQueryFnData`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | -| `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | +| `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `TQueryKey`; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, `TQueryFnData`, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/react/reference/functions/useSuspenseInfiniteQuery.md b/docs/framework/react/reference/functions/useSuspenseInfiniteQuery.md index a95350f1d69..32ec0074897 100644 --- a/docs/framework/react/reference/functions/useSuspenseInfiniteQuery.md +++ b/docs/framework/react/reference/functions/useSuspenseInfiniteQuery.md @@ -64,10 +64,10 @@ The [UseSuspenseInfiniteQueryOptions](../interfaces/UseSuspenseInfiniteQueryOpti | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `queryFn?` | (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | `skipToken` is not allowed here — Suspense hooks cannot render a "disabled" state, so a query function must always be provided, unless a default query function has been defined. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/react/reference/functions/useSuspenseQueries.md b/docs/framework/react/reference/functions/useSuspenseQueries.md index 2495b7ecf93..d51b67cacae 100644 --- a/docs/framework/react/reference/functions/useSuspenseQueries.md +++ b/docs/framework/react/reference/functions/useSuspenseQueries.md @@ -10,8 +10,15 @@ redirect_from: ## Overview ```ts -function useSuspenseQueries] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : [...{ [K in string | number | symbol]: GetUseSuspenseQueryResult }[]] : { [K in string | number | symbol]: GetUseSuspenseQueryResult }>(options: object, queryClient?: QueryClient): TCombinedResult; -function useSuspenseQueries] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : [...{ [K in string | number | symbol]: GetUseSuspenseQueryResult }[]] : { [K in string | number | symbol]: GetUseSuspenseQueryResult }>(options: object, queryClient?: QueryClient): TCombinedResult; +function useSuspenseQueries] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : [...{ [K in string | number | symbol]: GetUseSuspenseQueryResult }[]] : { [K in string | number | symbol]: GetUseSuspenseQueryResult }>(options: { + combine?: (result: T extends [] ? [] : T extends [Head] ? [GetUseSuspenseQueryResult] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : { [K in string | number | symbol]: GetUseSuspenseQueryResult }) => TCombinedResult; + queries: | readonly [T extends [] ? [] : T extends [Head] ? [GetUseSuspenseQueryOptions] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryOptions, GetUseSuspenseQueryOptions] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : ...[] extends [...(...)[]] ? [...(...)[]] : ... extends ... ? ... : ... : unknown[] extends T ? T : T extends UseSuspenseQueryOptions[] ? UseSuspenseQueryOptions[] : UseSuspenseQueryOptions[]] + | readonly [{ [K in string | number | symbol]: GetUseSuspenseQueryOptions }]; +}, queryClient?: QueryClient): TCombinedResult; +function useSuspenseQueries] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : [...{ [K in string | number | symbol]: GetUseSuspenseQueryResult }[]] : { [K in string | number | symbol]: GetUseSuspenseQueryResult }>(options: { + combine?: (result: T extends [] ? [] : T extends [Head] ? [GetUseSuspenseQueryResult] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : { [K in string | number | symbol]: GetUseSuspenseQueryResult }) => TCombinedResult; + queries: readonly [T extends [] ? [] : T extends [Head] ? [GetUseSuspenseQueryOptions] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryOptions, GetUseSuspenseQueryOptions] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...(...)[]] extends [...] ? [..., ..., ...] : ... extends ... ? ... : ... : unknown[] extends [...Tails[]] ? [...Tails[]] : [...(...)[]] extends ...[] ? ...[] : ...[] : unknown[] extends T ? T : T extends UseSuspenseQueryOptions[] ? UseSuspenseQueryOptions[] : UseSuspenseQueryOptions[]]; +}, queryClient?: QueryClient): TCombinedResult; ``` - [`{ queries, combine }` → `TCombinedResult`](#call-signature-1): The options for `useSuspenseQueries` are the same as for `useQueries`, except that the top-level `subscribed` option isn't supported, and each `query` can't have `throwOnError`, `enabled`, or `placeholderData`. @@ -24,7 +31,11 @@ See also: [Parameters](#parameters-summary) · [Returns](#returns-summary) ## Call Signature ```ts -function useSuspenseQueries] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : [...{ [K in string | number | symbol]: GetUseSuspenseQueryResult }[]] : { [K in string | number | symbol]: GetUseSuspenseQueryResult }>(options: object, queryClient?: QueryClient): TCombinedResult; +function useSuspenseQueries] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : [...{ [K in string | number | symbol]: GetUseSuspenseQueryResult }[]] : { [K in string | number | symbol]: GetUseSuspenseQueryResult }>(options: { + combine?: (result: T extends [] ? [] : T extends [Head] ? [GetUseSuspenseQueryResult] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : { [K in string | number | symbol]: GetUseSuspenseQueryResult }) => TCombinedResult; + queries: | readonly [T extends [] ? [] : T extends [Head] ? [GetUseSuspenseQueryOptions] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryOptions, GetUseSuspenseQueryOptions] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : ...[] extends [...(...)[]] ? [...(...)[]] : ... extends ... ? ... : ... : unknown[] extends T ? T : T extends UseSuspenseQueryOptions[] ? UseSuspenseQueryOptions[] : UseSuspenseQueryOptions[]] + | readonly [{ [K in string | number | symbol]: GetUseSuspenseQueryOptions }]; +}, queryClient?: QueryClient): TCombinedResult; ``` Defined in: [packages/react-query/src/useSuspenseQueries.ts:347](https://github.com/TanStack/query/blob/main/packages/react-query/src/useSuspenseQueries.ts#L347) @@ -236,7 +247,10 @@ function App() { ## Call Signature ```ts -function useSuspenseQueries] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : [...{ [K in string | number | symbol]: GetUseSuspenseQueryResult }[]] : { [K in string | number | symbol]: GetUseSuspenseQueryResult }>(options: object, queryClient?: QueryClient): TCombinedResult; +function useSuspenseQueries] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : [...{ [K in string | number | symbol]: GetUseSuspenseQueryResult }[]] : { [K in string | number | symbol]: GetUseSuspenseQueryResult }>(options: { + combine?: (result: T extends [] ? [] : T extends [Head] ? [GetUseSuspenseQueryResult] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryResult, GetUseSuspenseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : { [K in string | number | symbol]: GetUseSuspenseQueryResult }) => TCombinedResult; + queries: readonly [T extends [] ? [] : T extends [Head] ? [GetUseSuspenseQueryOptions] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseSuspenseQueryOptions, GetUseSuspenseQueryOptions] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...(...)[]] extends [...] ? [..., ..., ...] : ... extends ... ? ... : ... : unknown[] extends [...Tails[]] ? [...Tails[]] : [...(...)[]] extends ...[] ? ...[] : ...[] : unknown[] extends T ? T : T extends UseSuspenseQueryOptions[] ? UseSuspenseQueryOptions[] : UseSuspenseQueryOptions[]]; +}, queryClient?: QueryClient): TCombinedResult; ``` Defined in: [packages/react-query/src/useSuspenseQueries.ts:484](https://github.com/TanStack/query/blob/main/packages/react-query/src/useSuspenseQueries.ts#L484) diff --git a/docs/framework/react/reference/functions/useSuspenseQuery.md b/docs/framework/react/reference/functions/useSuspenseQuery.md index cfd428ebedb..608477c2357 100644 --- a/docs/framework/react/reference/functions/useSuspenseQuery.md +++ b/docs/framework/react/reference/functions/useSuspenseQuery.md @@ -57,10 +57,10 @@ The [UseSuspenseQueryOptions](../interfaces/UseSuspenseQueryOptions.md) to use | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | -| `queryFn?` | (`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | `skipToken` is not allowed here — Suspense hooks cannot render a "disabled" state, so a query function must always be provided, unless a default query function has been defined. | +| `persister?` | (`queryFn`: (`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `queryFn?` | (`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `TQueryKey`; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | `skipToken` is not allowed here — Suspense hooks cannot render a "disabled" state, so a query function must always be provided, unless a default query function has been defined. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, `TQueryFnData`, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/react/reference/interfaces/DefaultOptions.md b/docs/framework/react/reference/interfaces/DefaultOptions.md index 25628a573fb..f26d4b5519c 100644 --- a/docs/framework/react/reference/interfaces/DefaultOptions.md +++ b/docs/framework/react/reference/interfaces/DefaultOptions.md @@ -21,7 +21,7 @@ The default options of a `QueryClient`, applied to every query (`queries`), muta | Property | Type | Description | | ------ | ------ | ------ | | `dehydrate?` | [`DehydrateOptions`](DehydrateOptions.md) | Default options used when dehydrating the client's caches; see [DehydrateOptions](DehydrateOptions.md). | -| `hydrate?` | `object` | Default options used when hydrating queries and mutations; see [HydrateOptions](HydrateOptions.md). | +| `hydrate?` | \{ `deserializeData?`: `TransformerFn`; `mutations?`: [`MutationOptions`](MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: [`QueryOptions`](QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \} | Default options used when hydrating queries and mutations; see [HydrateOptions](HydrateOptions.md). | | `hydrate.deserializeData?` | `TransformerFn` | Transforms a query's `data` after it is read from the dehydrated state, reversing `serializeData`. | | `hydrate.mutations?` | [`MutationOptions`](MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\> | Default options merged into every mutation restored from the dehydrated state. | | `hydrate.queries?` | [`QueryOptions`](QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\> | Default options merged into every query restored from the dehydrated state. | diff --git a/docs/framework/react/reference/interfaces/EnsureQueryDataOptions.md b/docs/framework/react/reference/interfaces/EnsureQueryDataOptions.md index 489415d5d37..8ab6c8bf8b8 100644 --- a/docs/framework/react/reference/interfaces/EnsureQueryDataOptions.md +++ b/docs/framework/react/reference/interfaces/EnsureQueryDataOptions.md @@ -46,10 +46,10 @@ Defined in: [packages/query-core/src/types.ts:774](https://github.com/TanStack/q | ~~`maxPages?`~~ | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | ~~`meta?`~~ | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | ~~`networkMode?`~~ | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | ~~`queryFn?`~~ | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | ~~`queryHash?`~~ | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| ~~`queryKey`~~ | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| ~~`queryKey`~~ | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | ~~`queryKeyHashFn?`~~ | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | ~~`retry?`~~ | \| `number` \| `false` \| `true` \| ((`failureCount`: `number`, `error`: `TError`) => `boolean`) | `undefined` | If `false`, failed queries will not retry by default. If `true`, failed queries will retry infinitely. If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number. If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false. Defaults to `3` on the client and `0` on the server. | | ~~`retryDelay?`~~ | `number` \| ((`failureCount`: `number`, `error`: `TError`) => `number`) | `undefined` | This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. A function like `attempt => attempt * 1000` applies linear backoff. Defaults to a function that applies exponential backoff, capped at 30 seconds. | diff --git a/docs/framework/react/reference/interfaces/FetchQueryOptions.md b/docs/framework/react/reference/interfaces/FetchQueryOptions.md index 5a288291ebd..d6fcdc3ef78 100644 --- a/docs/framework/react/reference/interfaces/FetchQueryOptions.md +++ b/docs/framework/react/reference/interfaces/FetchQueryOptions.md @@ -50,10 +50,10 @@ Defined in: [packages/query-core/src/types.ts:752](https://github.com/TanStack/q | ~~`maxPages?`~~ | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | ~~`meta?`~~ | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | ~~`networkMode?`~~ | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | ~~`queryFn?`~~ | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | ~~`queryHash?`~~ | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| ~~`queryKey`~~ | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| ~~`queryKey`~~ | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | ~~`queryKeyHashFn?`~~ | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | ~~`retry?`~~ | \| `number` \| `false` \| `true` \| ((`failureCount`: `number`, `error`: `TError`) => `boolean`) | `undefined` | If `false`, failed queries will not retry by default. If `true`, failed queries will retry infinitely. If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number. If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false. Defaults to `3` on the client and `0` on the server. | | ~~`retryDelay?`~~ | `number` \| ((`failureCount`: `number`, `error`: `TError`) => `number`) | `undefined` | This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. A function like `attempt => attempt * 1000` applies linear backoff. Defaults to a function that applies exponential backoff, capped at 30 seconds. | diff --git a/docs/framework/react/reference/interfaces/HydrateOptions.md b/docs/framework/react/reference/interfaces/HydrateOptions.md index f070f729ff9..1dd5de960ae 100644 --- a/docs/framework/react/reference/interfaces/HydrateOptions.md +++ b/docs/framework/react/reference/interfaces/HydrateOptions.md @@ -14,7 +14,7 @@ Options for `hydrate`, controlling the default options applied to queries/mutati | Property | Type | Description | | ------ | ------ | ------ | -| `defaultOptions?` | `object` | Options applied to the queries and mutations restored from the dehydrated state. | +| `defaultOptions?` | \{ `deserializeData?`: `TransformerFn`; `mutations?`: [`MutationOptions`](MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: [`QueryOptions`](QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \} | Options applied to the queries and mutations restored from the dehydrated state. | | `defaultOptions.deserializeData?` | `TransformerFn` | Transforms a query's `data` after it is read from the dehydrated state, reversing `serializeData`. | | `defaultOptions.mutations?` | [`MutationOptions`](MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\> | Default options merged into every mutation restored from the dehydrated state. | | `defaultOptions.queries?` | [`QueryOptions`](QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\> | Default options merged into every query restored from the dehydrated state. | diff --git a/docs/framework/react/reference/interfaces/HydrationBoundaryProps.md b/docs/framework/react/reference/interfaces/HydrationBoundaryProps.md index 46be4f38773..2478f63dad1 100644 --- a/docs/framework/react/reference/interfaces/HydrationBoundaryProps.md +++ b/docs/framework/react/reference/interfaces/HydrationBoundaryProps.md @@ -14,6 +14,6 @@ The props accepted by `HydrationBoundary`. | Property | Type | Description | | ------ | ------ | ------ | | `children?` | `ReactNode` | The components to render — always rendered unconditionally, not gated on hydration. New queries are hydrated into the cache during render; for queries that already exist in the cache, only newer dehydrated data is hydrated, and that happens in an effect after commit, so `children` may render briefly before it lands. | -| `options?` | [`OmitKeyof`](../type-aliases/OmitKeyof.md)\<[`HydrateOptions`](HydrateOptions.md), `"defaultOptions"`\> & `object` | Optional. Note: unlike `hydrate`, `mutations` cannot be set here. | +| `options?` | [`OmitKeyof`](../type-aliases/OmitKeyof.md)\<[`HydrateOptions`](HydrateOptions.md), `"defaultOptions"`\> & \{ `defaultOptions?`: [`OmitKeyof`](../type-aliases/OmitKeyof.md)\<\{ `deserializeData?`: `TransformerFn`; `mutations?`: [`MutationOptions`](MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: [`QueryOptions`](QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \}, `"mutations"`\>; \} | Optional. Note: unlike `hydrate`, `mutations` cannot be set here. | | `queryClient?` | [`QueryClient`](../classes/QueryClient.md) | Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. | | `state` | [`DehydratedState`](DehydratedState.md) \| `null` \| `undefined` | The state to hydrate. | diff --git a/docs/framework/react/reference/interfaces/InfiniteQueryObserverOptions.md b/docs/framework/react/reference/interfaces/InfiniteQueryObserverOptions.md index 418e3d41ebf..c8cbb098e8a 100644 --- a/docs/framework/react/reference/interfaces/InfiniteQueryObserverOptions.md +++ b/docs/framework/react/reference/interfaces/InfiniteQueryObserverOptions.md @@ -52,11 +52,11 @@ The options of an `InfiniteQueryObserver`: [QueryObserverOptions](QueryObserverO | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| ((`previousData`: \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<[`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TError`, [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\> \| `undefined`) => \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/react/reference/interfaces/QueryExecuteOptions.md b/docs/framework/react/reference/interfaces/QueryExecuteOptions.md index a14c79bfc19..0f472791f1e 100644 --- a/docs/framework/react/reference/interfaces/QueryExecuteOptions.md +++ b/docs/framework/react/reference/interfaces/QueryExecuteOptions.md @@ -52,10 +52,10 @@ transforms the value the call resolves with. | `maxPages?` | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `retry?` | \| `number` \| `false` \| `true` \| ((`failureCount`: `number`, `error`: `TError`) => `boolean`) | `undefined` | If `false`, failed queries will not retry by default. If `true`, failed queries will retry infinitely. If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number. If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false. Defaults to `3` on the client and `0` on the server. | | `retryDelay?` | `number` \| ((`failureCount`: `number`, `error`: `TError`) => `number`) | `undefined` | This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. A function like `attempt => attempt * 1000` applies linear backoff. Defaults to a function that applies exponential backoff, capped at 30 seconds. | diff --git a/docs/framework/react/reference/interfaces/QueryObserverOptions.md b/docs/framework/react/reference/interfaces/QueryObserverOptions.md index 4825f4dad77..c7192281329 100644 --- a/docs/framework/react/reference/interfaces/QueryObserverOptions.md +++ b/docs/framework/react/reference/interfaces/QueryObserverOptions.md @@ -58,11 +58,11 @@ The options of a `QueryObserver`, and of the hooks built on it like `useQuery`: | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| `NonFunctionGuard`\<`TQueryData`\> \| ((`previousData`: `NonFunctionGuard`\<`TQueryData`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<`NonFunctionGuard`\<`TQueryData`\>, `TError`, `NonFunctionGuard`\<`TQueryData`\>, `TQueryKey`\> \| `undefined`) => `NonFunctionGuard`\<`TQueryData`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, `TQueryData`, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/react/reference/interfaces/QueryOptions.md b/docs/framework/react/reference/interfaces/QueryOptions.md index 574f08b670a..72c9a70ab0e 100644 --- a/docs/framework/react/reference/interfaces/QueryOptions.md +++ b/docs/framework/react/reference/interfaces/QueryOptions.md @@ -42,7 +42,7 @@ The options of a query itself — its `queryKey`, `queryFn`, retries, `gcTime`, | `maxPages?` | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `queryFn?` | \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) \| *typeof* [`skipToken`](../variables/skipToken.md) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | | `queryKey?` | `TQueryKey` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | diff --git a/docs/framework/react/reference/interfaces/UseBaseQueryOptions.md b/docs/framework/react/reference/interfaces/UseBaseQueryOptions.md index f86ff222440..f55b489786f 100644 --- a/docs/framework/react/reference/interfaces/UseBaseQueryOptions.md +++ b/docs/framework/react/reference/interfaces/UseBaseQueryOptions.md @@ -60,11 +60,11 @@ The type of your `queryKey`. | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| `NonFunctionGuard`\<`TQueryData`\> \| ((`previousData`: `NonFunctionGuard`\<`TQueryData`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<`NonFunctionGuard`\<`TQueryData`\>, `TError`, `NonFunctionGuard`\<`TQueryData`\>, `TQueryKey`\> \| `undefined`) => `NonFunctionGuard`\<`TQueryData`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | -| `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | +| `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `TQueryKey`; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, `TQueryData`, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/react/reference/interfaces/UseInfiniteQueryOptions.md b/docs/framework/react/reference/interfaces/UseInfiniteQueryOptions.md index aa5b6d2e909..75a3ff76c05 100644 --- a/docs/framework/react/reference/interfaces/UseInfiniteQueryOptions.md +++ b/docs/framework/react/reference/interfaces/UseInfiniteQueryOptions.md @@ -63,11 +63,11 @@ The type of the parameter passed to `queryFn` to fetch a given page. | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| ((`previousData`: \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<[`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TError`, [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\> \| `undefined`) => \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/react/reference/interfaces/UseQueryOptions.md b/docs/framework/react/reference/interfaces/UseQueryOptions.md index d9e4659105e..22caea89ddc 100644 --- a/docs/framework/react/reference/interfaces/UseQueryOptions.md +++ b/docs/framework/react/reference/interfaces/UseQueryOptions.md @@ -53,11 +53,11 @@ The type of your `queryKey`. | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| `NonFunctionGuard`\<`TQueryFnData`\> \| ((`previousData`: `NonFunctionGuard`\<`TQueryFnData`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<`NonFunctionGuard`\<`TQueryFnData`\>, `TError`, `NonFunctionGuard`\<`TQueryFnData`\>, `TQueryKey`\> \| `undefined`) => `NonFunctionGuard`\<`TQueryFnData`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | -| `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | +| `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `TQueryKey`; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, `TQueryFnData`, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/react/reference/interfaces/UseSuspenseInfiniteQueryOptions.md b/docs/framework/react/reference/interfaces/UseSuspenseInfiniteQueryOptions.md index 43a934b2727..59410b70e3d 100644 --- a/docs/framework/react/reference/interfaces/UseSuspenseInfiniteQueryOptions.md +++ b/docs/framework/react/reference/interfaces/UseSuspenseInfiniteQueryOptions.md @@ -62,10 +62,10 @@ The type of the parameter passed to `queryFn` to fetch a given page. | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `queryFn?` | (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | `skipToken` is not allowed here — Suspense hooks cannot render a "disabled" state, so a query function must always be provided, unless a default query function has been defined. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/react/reference/interfaces/UseSuspenseQueryOptions.md b/docs/framework/react/reference/interfaces/UseSuspenseQueryOptions.md index 9f986790f08..e28113fe4eb 100644 --- a/docs/framework/react/reference/interfaces/UseSuspenseQueryOptions.md +++ b/docs/framework/react/reference/interfaces/UseSuspenseQueryOptions.md @@ -53,10 +53,10 @@ The type of your `queryKey`. | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | -| `queryFn?` | (`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | `skipToken` is not allowed here — Suspense hooks cannot render a "disabled" state, so a query function must always be provided, unless a default query function has been defined. | +| `persister?` | (`queryFn`: (`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `queryFn?` | (`context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `TQueryKey`; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | `skipToken` is not allowed here — Suspense hooks cannot render a "disabled" state, so a query function must always be provided, unless a default query function has been defined. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, `TQueryFnData`, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/react/reference/type-aliases/AnyDataTag.md b/docs/framework/react/reference/type-aliases/AnyDataTag.md index 4b9304ed2ee..65d582ac8aa 100644 --- a/docs/framework/react/reference/type-aliases/AnyDataTag.md +++ b/docs/framework/react/reference/type-aliases/AnyDataTag.md @@ -6,7 +6,10 @@ title: AnyDataTag ```ts -type AnyDataTag = object; +type AnyDataTag = { + [dataTagErrorSymbol]: any; + [dataTagSymbol]: any; +}; ``` Defined in: [packages/query-core/src/types.ts:122](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L122) diff --git a/docs/framework/react/reference/type-aliases/DataTag.md b/docs/framework/react/reference/type-aliases/DataTag.md index 6e5cbfd46b9..22389c45a62 100644 --- a/docs/framework/react/reference/type-aliases/DataTag.md +++ b/docs/framework/react/reference/type-aliases/DataTag.md @@ -6,7 +6,10 @@ title: DataTag ```ts -type DataTag = TType extends AnyDataTag ? TType : TType & object; +type DataTag = TType extends AnyDataTag ? TType : TType & { + [dataTagErrorSymbol]: TError; + [dataTagSymbol]: TValue; +}; ``` Defined in: [packages/query-core/src/types.ts:137](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L137) diff --git a/docs/framework/react/reference/type-aliases/DefaultError.md b/docs/framework/react/reference/type-aliases/DefaultError.md index 85150115168..1db2fd40ed7 100644 --- a/docs/framework/react/reference/type-aliases/DefaultError.md +++ b/docs/framework/react/reference/type-aliases/DefaultError.md @@ -6,7 +6,9 @@ title: DefaultError ```ts -type DefaultError = Register extends object ? TError : Error; +type DefaultError = Register extends { + defaultError: infer TError; +} ? TError : Error; ``` Defined in: [packages/query-core/src/types.ts:83](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L83) diff --git a/docs/framework/react/reference/type-aliases/DefinedInitialDataInfiniteOptions.md b/docs/framework/react/reference/type-aliases/DefinedInitialDataInfiniteOptions.md index 154983c20ae..ed47b5cab63 100644 --- a/docs/framework/react/reference/type-aliases/DefinedInitialDataInfiniteOptions.md +++ b/docs/framework/react/reference/type-aliases/DefinedInitialDataInfiniteOptions.md @@ -6,7 +6,11 @@ title: DefinedInitialDataInfiniteOptions ```ts -type DefinedInitialDataInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions & object; +type DefinedInitialDataInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions & { + initialData: | NonUndefinedGuard> + | (() => NonUndefinedGuard>) + | undefined; +}; ``` Defined in: [packages/react-query/src/infiniteQueryOptions.ts:100](https://github.com/TanStack/query/blob/main/packages/react-query/src/infiniteQueryOptions.ts#L100) diff --git a/docs/framework/react/reference/type-aliases/DefinedInitialDataOptions.md b/docs/framework/react/reference/type-aliases/DefinedInitialDataOptions.md index c531487a40b..29dfd4ebcdb 100644 --- a/docs/framework/react/reference/type-aliases/DefinedInitialDataOptions.md +++ b/docs/framework/react/reference/type-aliases/DefinedInitialDataOptions.md @@ -6,7 +6,11 @@ title: DefinedInitialDataOptions ```ts -type DefinedInitialDataOptions = Omit, "queryFn"> & object; +type DefinedInitialDataOptions = Omit, "queryFn"> & { + initialData: | NonUndefinedGuard + | (() => NonUndefinedGuard); + queryFn?: QueryFunction; +}; ``` Defined in: [packages/react-query/src/queryOptions.ts:77](https://github.com/TanStack/query/blob/main/packages/react-query/src/queryOptions.ts#L77) diff --git a/docs/framework/react/reference/type-aliases/EnsureInfiniteQueryDataOptions.md b/docs/framework/react/reference/type-aliases/EnsureInfiniteQueryDataOptions.md index 1142c9bf005..d9c876a6029 100644 --- a/docs/framework/react/reference/type-aliases/EnsureInfiniteQueryDataOptions.md +++ b/docs/framework/react/reference/type-aliases/EnsureInfiniteQueryDataOptions.md @@ -6,7 +6,9 @@ title: EnsureInfiniteQueryDataOptions ```ts -type EnsureInfiniteQueryDataOptions = FetchInfiniteQueryOptions & object; +type EnsureInfiniteQueryDataOptions = FetchInfiniteQueryOptions & { + revalidateIfStale?: boolean; +}; ``` Defined in: [packages/query-core/src/types.ts:794](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L794) diff --git a/docs/framework/react/reference/type-aliases/MutationFunctionContext.md b/docs/framework/react/reference/type-aliases/MutationFunctionContext.md index 39a5d19316a..4b2d040ca9a 100644 --- a/docs/framework/react/reference/type-aliases/MutationFunctionContext.md +++ b/docs/framework/react/reference/type-aliases/MutationFunctionContext.md @@ -6,7 +6,11 @@ title: MutationFunctionContext ```ts -type MutationFunctionContext = object; +type MutationFunctionContext = { + client: QueryClient; + meta: MutationMeta | undefined; + mutationKey?: MutationKey; +}; ``` Defined in: [packages/query-core/src/types.ts:1855](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1855) diff --git a/docs/framework/react/reference/type-aliases/MutationKey.md b/docs/framework/react/reference/type-aliases/MutationKey.md index 7c598833c16..372431c32fb 100644 --- a/docs/framework/react/reference/type-aliases/MutationKey.md +++ b/docs/framework/react/reference/type-aliases/MutationKey.md @@ -6,7 +6,9 @@ title: MutationKey ```ts -type MutationKey = Register extends object ? TMutationKey extends ReadonlyArray ? TMutationKey : TMutationKey extends unknown[] ? TMutationKey : ReadonlyArray : ReadonlyArray; +type MutationKey = Register extends { + mutationKey: infer TMutationKey; +} ? TMutationKey extends ReadonlyArray ? TMutationKey : TMutationKey extends unknown[] ? TMutationKey : ReadonlyArray : ReadonlyArray; ``` Defined in: [packages/query-core/src/types.ts:1814](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1814) diff --git a/docs/framework/react/reference/type-aliases/MutationMeta.md b/docs/framework/react/reference/type-aliases/MutationMeta.md index 2b7dc7446ae..ddac47dcfc4 100644 --- a/docs/framework/react/reference/type-aliases/MutationMeta.md +++ b/docs/framework/react/reference/type-aliases/MutationMeta.md @@ -6,7 +6,9 @@ title: MutationMeta ```ts -type MutationMeta = Register extends object ? TMutationMeta extends Record ? TMutationMeta : Record : Record; +type MutationMeta = Register extends { + mutationMeta: infer TMutationMeta; +} ? TMutationMeta extends Record ? TMutationMeta : Record : Record; ``` Defined in: [packages/query-core/src/types.ts:1843](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1843) diff --git a/docs/framework/react/reference/type-aliases/MutationScope.md b/docs/framework/react/reference/type-aliases/MutationScope.md index 4357b2d629d..f859dc913a9 100644 --- a/docs/framework/react/reference/type-aliases/MutationScope.md +++ b/docs/framework/react/reference/type-aliases/MutationScope.md @@ -6,7 +6,9 @@ title: MutationScope ```ts -type MutationScope = object; +type MutationScope = { + id: string; +}; ``` Defined in: [packages/query-core/src/types.ts:1832](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1832) diff --git a/docs/framework/react/reference/type-aliases/QueryClientProviderProps.md b/docs/framework/react/reference/type-aliases/QueryClientProviderProps.md index 40e6b674c37..0066b38c61d 100644 --- a/docs/framework/react/reference/type-aliases/QueryClientProviderProps.md +++ b/docs/framework/react/reference/type-aliases/QueryClientProviderProps.md @@ -6,7 +6,10 @@ title: QueryClientProviderProps ```ts -type QueryClientProviderProps = object; +type QueryClientProviderProps = { + children?: React.ReactNode; + client: QueryClient; +}; ``` Defined in: [packages/react-query/src/QueryClientProvider.tsx:38](https://github.com/TanStack/query/blob/main/packages/react-query/src/QueryClientProvider.tsx#L38) diff --git a/docs/framework/react/reference/type-aliases/QueryFunctionContext.md b/docs/framework/react/reference/type-aliases/QueryFunctionContext.md index 15a8d2e9261..59324fb3aeb 100644 --- a/docs/framework/react/reference/type-aliases/QueryFunctionContext.md +++ b/docs/framework/react/reference/type-aliases/QueryFunctionContext.md @@ -6,7 +6,21 @@ title: QueryFunctionContext ```ts -type QueryFunctionContext = [TPageParam] extends [never] ? object : object; +type QueryFunctionContext = [TPageParam] extends [never] ? { + client: QueryClient; + direction?: unknown; + meta: QueryMeta | undefined; + pageParam?: unknown; + queryKey: TQueryKey; + signal: AbortSignal; +} : { + client: QueryClient; + direction: FetchDirection; + meta: QueryMeta | undefined; + pageParam: TPageParam; + queryKey: TQueryKey; + signal: AbortSignal; +}; ``` Defined in: [packages/query-core/src/types.ts:235](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L235) diff --git a/docs/framework/react/reference/type-aliases/QueryKey.md b/docs/framework/react/reference/type-aliases/QueryKey.md index 6a2c8ca5503..d358486f29b 100644 --- a/docs/framework/react/reference/type-aliases/QueryKey.md +++ b/docs/framework/react/reference/type-aliases/QueryKey.md @@ -6,7 +6,9 @@ title: QueryKey ```ts -type QueryKey = Register extends object ? TQueryKey extends ReadonlyArray ? TQueryKey : TQueryKey extends unknown[] ? TQueryKey : ReadonlyArray : ReadonlyArray; +type QueryKey = Register extends { + queryKey: infer TQueryKey; +} ? TQueryKey extends ReadonlyArray ? TQueryKey : TQueryKey extends unknown[] ? TQueryKey : ReadonlyArray : ReadonlyArray; ``` Defined in: [packages/query-core/src/types.ts:93](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L93) diff --git a/docs/framework/react/reference/type-aliases/QueryKeyWithDataTag.md b/docs/framework/react/reference/type-aliases/QueryKeyWithDataTag.md index 60244136ec1..f4c0ab86c9a 100644 --- a/docs/framework/react/reference/type-aliases/QueryKeyWithDataTag.md +++ b/docs/framework/react/reference/type-aliases/QueryKeyWithDataTag.md @@ -6,7 +6,9 @@ title: QueryKeyWithDataTag ```ts -type QueryKeyWithDataTag = object; +type QueryKeyWithDataTag = { + queryKey: DataTag; +}; ``` Defined in: [packages/query-core/src/types.ts:152](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L152) diff --git a/docs/framework/react/reference/type-aliases/QueryMeta.md b/docs/framework/react/reference/type-aliases/QueryMeta.md index 3df2e5a17bd..6f1b27a3d9e 100644 --- a/docs/framework/react/reference/type-aliases/QueryMeta.md +++ b/docs/framework/react/reference/type-aliases/QueryMeta.md @@ -6,7 +6,9 @@ title: QueryMeta ```ts -type QueryMeta = Register extends object ? TQueryMeta extends Record ? TQueryMeta : Record : Record; +type QueryMeta = Register extends { + queryMeta: infer TQueryMeta; +} ? TQueryMeta extends Record ? TQueryMeta : Record : Record; ``` Defined in: [packages/query-core/src/types.ts:330](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L330) diff --git a/docs/framework/react/reference/type-aliases/TimeoutProvider.md b/docs/framework/react/reference/type-aliases/TimeoutProvider.md index 6e3fd194540..88cd72aa7e3 100644 --- a/docs/framework/react/reference/type-aliases/TimeoutProvider.md +++ b/docs/framework/react/reference/type-aliases/TimeoutProvider.md @@ -6,7 +6,12 @@ title: TimeoutProvider ```ts -type TimeoutProvider = object; +type TimeoutProvider = { + clearInterval: (intervalId: TTimerId | undefined) => void; + clearTimeout: (timeoutId: TTimerId | undefined) => void; + setInterval: (callback: TimeoutCallback, delay: number) => TTimerId; + setTimeout: (callback: TimeoutCallback, delay: number) => TTimerId; +}; ``` Defined in: [packages/query-core/src/timeoutManager.ts:28](https://github.com/TanStack/query/blob/main/packages/query-core/src/timeoutManager.ts#L28) diff --git a/docs/framework/react/reference/type-aliases/UndefinedInitialDataInfiniteOptions.md b/docs/framework/react/reference/type-aliases/UndefinedInitialDataInfiniteOptions.md index 2b89cdba12a..efb1351d38a 100644 --- a/docs/framework/react/reference/type-aliases/UndefinedInitialDataInfiniteOptions.md +++ b/docs/framework/react/reference/type-aliases/UndefinedInitialDataInfiniteOptions.md @@ -6,7 +6,10 @@ title: UndefinedInitialDataInfiniteOptions ```ts -type UndefinedInitialDataInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions & object; +type UndefinedInitialDataInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions & { + initialData?: | NonUndefinedGuard> + | InitialDataFunction>>; +}; ``` Defined in: [packages/react-query/src/infiniteQueryOptions.ts:23](https://github.com/TanStack/query/blob/main/packages/react-query/src/infiniteQueryOptions.ts#L23) diff --git a/docs/framework/react/reference/type-aliases/UndefinedInitialDataOptions.md b/docs/framework/react/reference/type-aliases/UndefinedInitialDataOptions.md index 620c89664e5..4cb382f8319 100644 --- a/docs/framework/react/reference/type-aliases/UndefinedInitialDataOptions.md +++ b/docs/framework/react/reference/type-aliases/UndefinedInitialDataOptions.md @@ -6,7 +6,10 @@ title: UndefinedInitialDataOptions ```ts -type UndefinedInitialDataOptions = UseQueryOptions & object; +type UndefinedInitialDataOptions = UseQueryOptions & { + initialData?: | InitialDataFunction> + | NonUndefinedGuard; +}; ``` Defined in: [packages/react-query/src/queryOptions.ts:21](https://github.com/TanStack/query/blob/main/packages/react-query/src/queryOptions.ts#L21) diff --git a/docs/framework/react/reference/type-aliases/UnusedSkipTokenInfiniteOptions.md b/docs/framework/react/reference/type-aliases/UnusedSkipTokenInfiniteOptions.md index 6205628304c..21e5aa24e56 100644 --- a/docs/framework/react/reference/type-aliases/UnusedSkipTokenInfiniteOptions.md +++ b/docs/framework/react/reference/type-aliases/UnusedSkipTokenInfiniteOptions.md @@ -6,7 +6,9 @@ title: UnusedSkipTokenInfiniteOptions ```ts -type UnusedSkipTokenInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = OmitKeyof, "queryFn"> & object; +type UnusedSkipTokenInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = OmitKeyof, "queryFn"> & { + queryFn?: Exclude["queryFn"], SkipToken | undefined>; +}; ``` Defined in: [packages/react-query/src/infiniteQueryOptions.ts:62](https://github.com/TanStack/query/blob/main/packages/react-query/src/infiniteQueryOptions.ts#L62) diff --git a/docs/framework/react/reference/type-aliases/UnusedSkipTokenOptions.md b/docs/framework/react/reference/type-aliases/UnusedSkipTokenOptions.md index 9239aa943b4..805a82858db 100644 --- a/docs/framework/react/reference/type-aliases/UnusedSkipTokenOptions.md +++ b/docs/framework/react/reference/type-aliases/UnusedSkipTokenOptions.md @@ -6,7 +6,9 @@ title: UnusedSkipTokenOptions ```ts -type UnusedSkipTokenOptions = OmitKeyof, "queryFn"> & object; +type UnusedSkipTokenOptions = OmitKeyof, "queryFn"> & { + queryFn?: Exclude["queryFn"], SkipToken | undefined>; +}; ``` Defined in: [packages/react-query/src/queryOptions.ts:48](https://github.com/TanStack/query/blob/main/packages/react-query/src/queryOptions.ts#L48) diff --git a/docs/framework/react/reference/type-aliases/UseBaseMutationResult.md b/docs/framework/react/reference/type-aliases/UseBaseMutationResult.md index efb2f5e1fcc..811c4bd237a 100644 --- a/docs/framework/react/reference/type-aliases/UseBaseMutationResult.md +++ b/docs/framework/react/reference/type-aliases/UseBaseMutationResult.md @@ -8,7 +8,9 @@ title: UseBaseMutationResult ```ts type UseBaseMutationResult = Override, { mutate: UseMutateFunction; -}> & object; +}> & { + mutateAsync: UseMutateAsyncFunction; +}; ``` Defined in: [packages/react-query/src/types.ts:453](https://github.com/TanStack/query/blob/main/packages/react-query/src/types.ts#L453) diff --git a/docs/framework/react/reference/type-aliases/UsePrefetchInfiniteQueryOptions.md b/docs/framework/react/reference/type-aliases/UsePrefetchInfiniteQueryOptions.md index 817ab4d9096..1ce73389b0c 100644 --- a/docs/framework/react/reference/type-aliases/UsePrefetchInfiniteQueryOptions.md +++ b/docs/framework/react/reference/type-aliases/UsePrefetchInfiniteQueryOptions.md @@ -6,7 +6,9 @@ title: UsePrefetchInfiniteQueryOptions ```ts -type UsePrefetchInfiniteQueryOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = DistributiveOmit, "queryFn"> & object; +type UsePrefetchInfiniteQueryOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = DistributiveOmit, "queryFn"> & { + queryFn?: Exclude["queryFn"], SkipToken>; +}; ``` Defined in: [packages/react-query/src/types.ts:114](https://github.com/TanStack/query/blob/main/packages/react-query/src/types.ts#L114) diff --git a/docs/framework/react/reference/type-aliases/UsePrefetchQueryOptions.md b/docs/framework/react/reference/type-aliases/UsePrefetchQueryOptions.md index 41d3d6e4a3d..3c389490b7a 100644 --- a/docs/framework/react/reference/type-aliases/UsePrefetchQueryOptions.md +++ b/docs/framework/react/reference/type-aliases/UsePrefetchQueryOptions.md @@ -6,7 +6,9 @@ title: UsePrefetchQueryOptions ```ts -type UsePrefetchQueryOptions = DistributiveOmit, "queryFn"> & object; +type UsePrefetchQueryOptions = DistributiveOmit, "queryFn"> & { + queryFn?: Exclude["queryFn"], SkipToken>; +}; ``` Defined in: [packages/react-query/src/types.ts:77](https://github.com/TanStack/query/blob/main/packages/react-query/src/types.ts#L77) diff --git a/docs/framework/react/reference/variables/environmentManager.md b/docs/framework/react/reference/variables/environmentManager.md index cbddf05f1cd..bfb15b4b588 100644 --- a/docs/framework/react/reference/variables/environmentManager.md +++ b/docs/framework/react/reference/variables/environmentManager.md @@ -8,7 +8,10 @@ redirect_from: ```ts -const environmentManager: object; +const environmentManager: { + isServer: () => boolean; + setIsServer(isServerValue: IsServerValue): void; +}; ``` Defined in: [packages/query-core/src/environmentManager.ts:32](https://github.com/TanStack/query/blob/main/packages/query-core/src/environmentManager.ts#L32) diff --git a/docs/framework/react/reference/variables/notifyManager.md b/docs/framework/react/reference/variables/notifyManager.md index db50dbc6d39..7dd15d5971f 100644 --- a/docs/framework/react/reference/variables/notifyManager.md +++ b/docs/framework/react/reference/variables/notifyManager.md @@ -9,7 +9,14 @@ redirect_from: ```ts -const notifyManager: object; +const notifyManager: { + batch: (callback: () => T) => T; + batchCalls: (callback: BatchCallsCallback) => BatchCallsCallback; + schedule: (callback: NotifyCallback) => void; + setBatchNotifyFunction: (fn: BatchNotifyFunction) => void; + setNotifyFunction: (fn: NotifyFunction) => void; + setScheduler: (fn: ScheduleFunction) => void; +}; ``` Defined in: [packages/query-core/src/notifyManager.ts:154](https://github.com/TanStack/query/blob/main/packages/query-core/src/notifyManager.ts#L154) diff --git a/docs/framework/solid/reference/functions/experimental_streamedQuery.md b/docs/framework/solid/reference/functions/experimental_streamedQuery.md index 38ca68beefc..2c209ebcad6 100644 --- a/docs/framework/solid/reference/functions/experimental_streamedQuery.md +++ b/docs/framework/solid/reference/functions/experimental_streamedQuery.md @@ -6,7 +6,14 @@ title: experimental_streamedQuery ```ts -function experimental_streamedQuery(options: StreamedQueryParams): (context: object) => TData | Promise; +function experimental_streamedQuery(options: StreamedQueryParams): (context: { + client: QueryClient; + direction?: unknown; + meta: Record | undefined; + pageParam?: unknown; + queryKey: TQueryKey; + signal: AbortSignal; +}) => TData | Promise; ``` Defined in: [packages/query-core/src/streamedQuery.ts:70](https://github.com/TanStack/query/blob/main/packages/query-core/src/streamedQuery.ts#L70) @@ -43,7 +50,14 @@ The `streamFn` that returns an AsyncIterable to stream data from, and the option A query function to pass as `queryFn`. -(`context`: `object`) => `TData` \| `Promise`\<`TData`\> +(`context`: \{ + `client`: `QueryClient`; + `direction?`: `unknown`; + `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; + `pageParam?`: `unknown`; + `queryKey`: `TQueryKey`; + `signal`: `AbortSignal`; +\}) => `TData` \| `Promise`\<`TData`\> ## Example diff --git a/docs/framework/solid/reference/functions/hydrate.md b/docs/framework/solid/reference/functions/hydrate.md index 568e1a226ff..8c3a8b2213e 100644 --- a/docs/framework/solid/reference/functions/hydrate.md +++ b/docs/framework/solid/reference/functions/hydrate.md @@ -56,7 +56,7 @@ client's `defaultOptions.hydrate`), and `deserializeData` to reverse `serializeD | Property | Type | Description | | ------ | ------ | ------ | -| `defaultOptions?` | `object` | Options applied to the queries and mutations restored from the dehydrated state. | +| `defaultOptions?` | \{ `deserializeData?`: `TransformerFn`; `mutations?`: `MutationOptions`\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: `QueryOptions`\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \} | Options applied to the queries and mutations restored from the dehydrated state. | | `defaultOptions.deserializeData?` | `TransformerFn` | Transforms a query's `data` after it is read from the dehydrated state, reversing `serializeData`. | | `defaultOptions.mutations?` | `MutationOptions`\<`unknown`, `Error`, `unknown`, `unknown`\> | Default options merged into every mutation restored from the dehydrated state. | | `defaultOptions.queries?` | `QueryOptions`\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\> | Default options merged into every query restored from the dehydrated state. | diff --git a/docs/framework/solid/reference/functions/infiniteQueryOptions.md b/docs/framework/solid/reference/functions/infiniteQueryOptions.md index d5ec121cbc1..bcacfc015c0 100644 --- a/docs/framework/solid/reference/functions/infiniteQueryOptions.md +++ b/docs/framework/solid/reference/functions/infiniteQueryOptions.md @@ -10,8 +10,13 @@ redirect_from: ## Overview ```ts -function infiniteQueryOptions, TQueryKey extends readonly unknown[] = readonly unknown[], TPageParam = unknown>(options: InfiniteQueryOptions & object): ReturnType> & QueryKeyWithDataTag, TError>; -function infiniteQueryOptions, TQueryKey extends readonly unknown[] = readonly unknown[], TPageParam = unknown>(options: InfiniteQueryOptions & object): ReturnType> & QueryKeyWithDataTag, TError>; +function infiniteQueryOptions, TQueryKey extends readonly unknown[] = readonly unknown[], TPageParam = unknown>(options: InfiniteQueryOptions & { + initialData: | InfiniteData + | (() => InfiniteData); +}): ReturnType> & QueryKeyWithDataTag, TError>; +function infiniteQueryOptions, TQueryKey extends readonly unknown[] = readonly unknown[], TPageParam = unknown>(options: InfiniteQueryOptions & { + initialData?: undefined; +}): ReturnType> & QueryKeyWithDataTag, TError>; ``` - [`ReturnType` → `ReturnType & QueryKeyWithDataTag`](#call-signature-1): You can generally pass everything to `infiniteQueryOptions` that you can also pass to `useInfiniteQuery`. These options can be shared across hooks and imperative APIs such as `queryClient.infiniteQuery`. `options.queryKey` is required and is the query key to generate options for. @@ -24,7 +29,10 @@ See also: [Parameters](#parameters-summary) · [Returns](#returns-summary) ## Call Signature ```ts -function infiniteQueryOptions, TQueryKey extends readonly unknown[] = readonly unknown[], TPageParam = unknown>(options: InfiniteQueryOptions & object): ReturnType> & QueryKeyWithDataTag, TError>; +function infiniteQueryOptions, TQueryKey extends readonly unknown[] = readonly unknown[], TPageParam = unknown>(options: InfiniteQueryOptions & { + initialData: | InfiniteData + | (() => InfiniteData); +}): ReturnType> & QueryKeyWithDataTag, TError>; ``` Defined in: [packages/solid-query/src/infiniteQueryOptions.ts:101](https://github.com/TanStack/query/blob/main/packages/solid-query/src/infiniteQueryOptions.ts#L101) @@ -61,7 +69,10 @@ This overload is selected when `initialData` is set. #### options -[`InfiniteQueryOptions`](../interfaces/InfiniteQueryOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`, `TPageParam`\> & `object` +[`InfiniteQueryOptions`](../interfaces/InfiniteQueryOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`, `TPageParam`\> & \{ + `initialData`: \| [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> + \| (() => [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`\>); +\} The [DefinedInitialDataInfiniteOptions](../type-aliases/DefinedInitialDataInfiniteOptions.md) to use — everything you can pass to `useInfiniteQuery`, with `initialData` set. @@ -112,7 +123,9 @@ function Projects() { ## Call Signature ```ts -function infiniteQueryOptions, TQueryKey extends readonly unknown[] = readonly unknown[], TPageParam = unknown>(options: InfiniteQueryOptions & object): ReturnType> & QueryKeyWithDataTag, TError>; +function infiniteQueryOptions, TQueryKey extends readonly unknown[] = readonly unknown[], TPageParam = unknown>(options: InfiniteQueryOptions & { + initialData?: undefined; +}): ReturnType> & QueryKeyWithDataTag, TError>; ``` Defined in: [packages/solid-query/src/infiniteQueryOptions.ts:168](https://github.com/TanStack/query/blob/main/packages/solid-query/src/infiniteQueryOptions.ts#L168) @@ -147,7 +160,9 @@ These options can be shared across hooks and imperative APIs such as `queryClien #### options -[`InfiniteQueryOptions`](../interfaces/InfiniteQueryOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`, `TPageParam`\> & `object` +[`InfiniteQueryOptions`](../interfaces/InfiniteQueryOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`, `TPageParam`\> & \{ + `initialData?`: `undefined`; +\} The [UndefinedInitialDataInfiniteOptions](../type-aliases/UndefinedInitialDataInfiniteOptions.md) to use — everything you can pass to `useInfiniteQuery`. @@ -201,7 +216,9 @@ function Comments(props: { postId: string }) { ### options -[`InfiniteQueryOptions`](../interfaces/InfiniteQueryOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`, `TPageParam`\> & `object` +[`InfiniteQueryOptions`](../interfaces/InfiniteQueryOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`, `TPageParam`\> & \{ + `initialData?`: `undefined`; +\} The [UndefinedInitialDataInfiniteOptions](../type-aliases/UndefinedInitialDataInfiniteOptions.md) to use — everything you can pass to `useInfiniteQuery`. diff --git a/docs/framework/solid/reference/functions/queryOptions.md b/docs/framework/solid/reference/functions/queryOptions.md index f5989618383..f64d377e6b9 100644 --- a/docs/framework/solid/reference/functions/queryOptions.md +++ b/docs/framework/solid/reference/functions/queryOptions.md @@ -10,8 +10,12 @@ redirect_from: ## Overview ```ts -function queryOptions(options: QueryOptions & object): ReturnType> & QueryKeyWithDataTag; -function queryOptions(options: QueryOptions & object): ReturnType> & QueryKeyWithDataTag; +function queryOptions(options: QueryOptions & { + initialData: TQueryFnData | (() => TQueryFnData); +}): ReturnType> & QueryKeyWithDataTag; +function queryOptions(options: QueryOptions & { + initialData?: undefined; +}): ReturnType> & QueryKeyWithDataTag; ``` - [`ReturnType` → `ReturnType & QueryKeyWithDataTag`](#call-signature-1): You can generally pass everything to `queryOptions` that you can also pass to `useQuery`. These options can be shared across hooks and imperative APIs such as `queryClient.query`. `options.queryKey` is required and is the query key to generate options for. @@ -24,7 +28,9 @@ See also: [Parameters](#parameters-summary) · [Returns](#returns-summary) ## Call Signature ```ts -function queryOptions(options: QueryOptions & object): ReturnType> & QueryKeyWithDataTag; +function queryOptions(options: QueryOptions & { + initialData: TQueryFnData | (() => TQueryFnData); +}): ReturnType> & QueryKeyWithDataTag; ``` Defined in: [packages/solid-query/src/queryOptions.ts:86](https://github.com/TanStack/query/blob/main/packages/solid-query/src/queryOptions.ts#L86) @@ -58,7 +64,9 @@ a `select` changes `TData` to include `undefined`). #### options -[`QueryOptions`](../interfaces/QueryOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\> & `object` +[`QueryOptions`](../interfaces/QueryOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\> & \{ + `initialData`: `TQueryFnData` \| (() => `TQueryFnData`); +\} The [DefinedInitialDataOptions](../type-aliases/DefinedInitialDataOptions.md) to use — everything you can pass to `useQuery`, with `initialData` set. @@ -105,7 +113,9 @@ function Posts() { ## Call Signature ```ts -function queryOptions(options: QueryOptions & object): ReturnType> & QueryKeyWithDataTag; +function queryOptions(options: QueryOptions & { + initialData?: undefined; +}): ReturnType> & QueryKeyWithDataTag; ``` Defined in: [packages/solid-query/src/queryOptions.ts:134](https://github.com/TanStack/query/blob/main/packages/solid-query/src/queryOptions.ts#L134) @@ -136,7 +146,9 @@ is the query key to generate options for. #### options -[`QueryOptions`](../interfaces/QueryOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\> & `object` +[`QueryOptions`](../interfaces/QueryOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\> & \{ + `initialData?`: `undefined`; +\} The [UndefinedInitialDataOptions](../type-aliases/UndefinedInitialDataOptions.md) to use — everything you can pass to `useQuery`. @@ -184,7 +196,9 @@ function Post(props: { id: string }) { ### options -[`QueryOptions`](../interfaces/QueryOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\> & `object` +[`QueryOptions`](../interfaces/QueryOptions.md)\<`TQueryFnData`, `TError`, `TData`, `TQueryKey`\> & \{ + `initialData?`: `undefined`; +\} The [UndefinedInitialDataOptions](../type-aliases/UndefinedInitialDataOptions.md) to use — everything you can pass to `useQuery`. diff --git a/docs/framework/solid/reference/interfaces/DefaultOptions.md b/docs/framework/solid/reference/interfaces/DefaultOptions.md index b3ed16057f5..dbdd71f64c8 100644 --- a/docs/framework/solid/reference/interfaces/DefaultOptions.md +++ b/docs/framework/solid/reference/interfaces/DefaultOptions.md @@ -27,7 +27,7 @@ The default type of errors thrown by queries and mutations using this `QueryClie | Property | Type | Description | Overrides | | ------ | ------ | ------ | ------ | | `dehydrate?` | [`DehydrateOptions`](DehydrateOptions.md) | Default options used when dehydrating the client's caches; see [DehydrateOptions](DehydrateOptions.md). | - | -| `hydrate?` | `object` | Default options used when hydrating queries and mutations; see [HydrateOptions](HydrateOptions.md). | - | +| `hydrate?` | \{ `deserializeData?`: `TransformerFn`; `mutations?`: `MutationOptions`\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: `QueryOptions`\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \} | Default options used when hydrating queries and mutations; see [HydrateOptions](HydrateOptions.md). | - | | `hydrate.deserializeData?` | `TransformerFn` | Transforms a query's `data` after it is read from the dehydrated state, reversing `serializeData`. | - | | `hydrate.mutations?` | `MutationOptions`\<`unknown`, `Error`, `unknown`, `unknown`\> | Default options merged into every mutation restored from the dehydrated state. | - | | `hydrate.queries?` | `QueryOptions`\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\> | Default options merged into every query restored from the dehydrated state. | - | diff --git a/docs/framework/solid/reference/interfaces/EnsureQueryDataOptions.md b/docs/framework/solid/reference/interfaces/EnsureQueryDataOptions.md index 489415d5d37..c53cef82839 100644 --- a/docs/framework/solid/reference/interfaces/EnsureQueryDataOptions.md +++ b/docs/framework/solid/reference/interfaces/EnsureQueryDataOptions.md @@ -46,10 +46,10 @@ Defined in: [packages/query-core/src/types.ts:774](https://github.com/TanStack/q | ~~`maxPages?`~~ | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | ~~`meta?`~~ | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | ~~`networkMode?`~~ | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: `QueryClient`; `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | ~~`queryFn?`~~ | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | ~~`queryHash?`~~ | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| ~~`queryKey`~~ | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| ~~`queryKey`~~ | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | ~~`queryKeyHashFn?`~~ | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | ~~`retry?`~~ | \| `number` \| `false` \| `true` \| ((`failureCount`: `number`, `error`: `TError`) => `boolean`) | `undefined` | If `false`, failed queries will not retry by default. If `true`, failed queries will retry infinitely. If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number. If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false. Defaults to `3` on the client and `0` on the server. | | ~~`retryDelay?`~~ | `number` \| ((`failureCount`: `number`, `error`: `TError`) => `number`) | `undefined` | This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. A function like `attempt => attempt * 1000` applies linear backoff. Defaults to a function that applies exponential backoff, capped at 30 seconds. | diff --git a/docs/framework/solid/reference/interfaces/FetchQueryOptions.md b/docs/framework/solid/reference/interfaces/FetchQueryOptions.md index c02ad9e6a64..8a1e203283d 100644 --- a/docs/framework/solid/reference/interfaces/FetchQueryOptions.md +++ b/docs/framework/solid/reference/interfaces/FetchQueryOptions.md @@ -50,10 +50,10 @@ Defined in: [packages/query-core/src/types.ts:752](https://github.com/TanStack/q | ~~`maxPages?`~~ | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | ~~`meta?`~~ | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | ~~`networkMode?`~~ | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: `QueryClient`; `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | ~~`queryFn?`~~ | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | ~~`queryHash?`~~ | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| ~~`queryKey`~~ | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| ~~`queryKey`~~ | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | ~~`queryKeyHashFn?`~~ | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | ~~`retry?`~~ | \| `number` \| `false` \| `true` \| ((`failureCount`: `number`, `error`: `TError`) => `boolean`) | `undefined` | If `false`, failed queries will not retry by default. If `true`, failed queries will retry infinitely. If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number. If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false. Defaults to `3` on the client and `0` on the server. | | ~~`retryDelay?`~~ | `number` \| ((`failureCount`: `number`, `error`: `TError`) => `number`) | `undefined` | This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. A function like `attempt => attempt * 1000` applies linear backoff. Defaults to a function that applies exponential backoff, capped at 30 seconds. | diff --git a/docs/framework/solid/reference/interfaces/HydrateOptions.md b/docs/framework/solid/reference/interfaces/HydrateOptions.md index 5f682d10549..8415521afc3 100644 --- a/docs/framework/solid/reference/interfaces/HydrateOptions.md +++ b/docs/framework/solid/reference/interfaces/HydrateOptions.md @@ -14,7 +14,7 @@ Options for `hydrate`, controlling the default options applied to queries/mutati | Property | Type | Description | | ------ | ------ | ------ | -| `defaultOptions?` | `object` | Options applied to the queries and mutations restored from the dehydrated state. | +| `defaultOptions?` | \{ `deserializeData?`: `TransformerFn`; `mutations?`: `MutationOptions`\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: `QueryOptions`\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \} | Options applied to the queries and mutations restored from the dehydrated state. | | `defaultOptions.deserializeData?` | `TransformerFn` | Transforms a query's `data` after it is read from the dehydrated state, reversing `serializeData`. | | `defaultOptions.mutations?` | `MutationOptions`\<`unknown`, `Error`, `unknown`, `unknown`\> | Default options merged into every mutation restored from the dehydrated state. | | `defaultOptions.queries?` | `QueryOptions`\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\> | Default options merged into every query restored from the dehydrated state. | diff --git a/docs/framework/solid/reference/interfaces/InfiniteQueryObserverOptions.md b/docs/framework/solid/reference/interfaces/InfiniteQueryObserverOptions.md index 1908be24c54..507cc08818a 100644 --- a/docs/framework/solid/reference/interfaces/InfiniteQueryObserverOptions.md +++ b/docs/framework/solid/reference/interfaces/InfiniteQueryObserverOptions.md @@ -60,11 +60,11 @@ The type of the parameter passed to `queryFn` to fetch a given page. | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: `QueryClient`; `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| ((`previousData`: \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<[`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TError`, [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\> \| `undefined`) => \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `reconcile?` | \| `string` \| `false` \| ((`oldData`: `TData` \| `undefined`, `newData`: `TData`) => `TData`) | `undefined` | Set this to a reconciliation key to enable reconciliation between query results. Set this to `false` to disable reconciliation between query results. Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom reconciliation logic. Defaults reconciliation to false. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | diff --git a/docs/framework/solid/reference/interfaces/InfiniteQueryOptions.md b/docs/framework/solid/reference/interfaces/InfiniteQueryOptions.md index 360a9e53d96..aa06fa569ce 100644 --- a/docs/framework/solid/reference/interfaces/InfiniteQueryOptions.md +++ b/docs/framework/solid/reference/interfaces/InfiniteQueryOptions.md @@ -61,7 +61,7 @@ The type of the parameter passed to `queryFn` to fetch a given page. | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: `QueryClient`; `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| ((`previousData`: \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<[`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TError`, [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\> \| `undefined`) => \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | diff --git a/docs/framework/solid/reference/interfaces/QueryExecuteOptions.md b/docs/framework/solid/reference/interfaces/QueryExecuteOptions.md index c299d45b02d..dba9c8cf42e 100644 --- a/docs/framework/solid/reference/interfaces/QueryExecuteOptions.md +++ b/docs/framework/solid/reference/interfaces/QueryExecuteOptions.md @@ -52,10 +52,10 @@ transforms the value the call resolves with. | `maxPages?` | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: `QueryClient`; `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `retry?` | \| `number` \| `false` \| `true` \| ((`failureCount`: `number`, `error`: `TError`) => `boolean`) | `undefined` | If `false`, failed queries will not retry by default. If `true`, failed queries will retry infinitely. If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number. If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false. Defaults to `3` on the client and `0` on the server. | | `retryDelay?` | `number` \| ((`failureCount`: `number`, `error`: `TError`) => `number`) | `undefined` | This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. A function like `attempt => attempt * 1000` applies linear backoff. Defaults to a function that applies exponential backoff, capped at 30 seconds. | diff --git a/docs/framework/solid/reference/interfaces/QueryObserverOptions.md b/docs/framework/solid/reference/interfaces/QueryObserverOptions.md index 64d891d9f0c..4262c013ec9 100644 --- a/docs/framework/solid/reference/interfaces/QueryObserverOptions.md +++ b/docs/framework/solid/reference/interfaces/QueryObserverOptions.md @@ -64,11 +64,11 @@ is shared with an infinite query's observer options. Defaults to `never` for reg | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: `QueryClient`; `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| `NonFunctionGuard`\<`TQueryData`\> \| ((`previousData`: `NonFunctionGuard`\<`TQueryData`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<`NonFunctionGuard`\<`TQueryData`\>, `TError`, `NonFunctionGuard`\<`TQueryData`\>, `TQueryKey`\> \| `undefined`) => `NonFunctionGuard`\<`TQueryData`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `reconcile?` | \| `string` \| `false` \| ((`oldData`: `TData` \| `undefined`, `newData`: `TData`) => `TData`) | `undefined` | Set this to a reconciliation key to enable reconciliation between query results. Set this to `false` to disable reconciliation between query results. Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom reconciliation logic. Defaults reconciliation to false. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, `TQueryData`, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | diff --git a/docs/framework/solid/reference/interfaces/QueryOptions.md b/docs/framework/solid/reference/interfaces/QueryOptions.md index 89ac5422a8d..6d5fab11aee 100644 --- a/docs/framework/solid/reference/interfaces/QueryOptions.md +++ b/docs/framework/solid/reference/interfaces/QueryOptions.md @@ -53,11 +53,11 @@ The type of your `queryKey`. | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: \{ `client`: `QueryClient`; `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: `QueryClient`; `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| `NonFunctionGuard`\<`TQueryFnData`\> \| ((`previousData`: `NonFunctionGuard`\<`TQueryFnData`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<`NonFunctionGuard`\<`TQueryFnData`\>, `TError`, `NonFunctionGuard`\<`TQueryFnData`\>, `TQueryKey`\> \| `undefined`) => `NonFunctionGuard`\<`TQueryFnData`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | -| `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | +| `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: \{ `client`: `QueryClient`; `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `TQueryKey`; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `reconcile?` | \| `string` \| `false` \| ((`oldData`: `TData` \| `undefined`, `newData`: `TData`) => `TData`) | `undefined` | Set this to a reconciliation key to enable reconciliation between query results. Set this to `false` to disable reconciliation between query results. Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom reconciliation logic. Defaults reconciliation to false. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, `TQueryFnData`, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | diff --git a/docs/framework/solid/reference/interfaces/UseBaseQueryOptions.md b/docs/framework/solid/reference/interfaces/UseBaseQueryOptions.md index ad3936a8f90..e57cfdee6c3 100644 --- a/docs/framework/solid/reference/interfaces/UseBaseQueryOptions.md +++ b/docs/framework/solid/reference/interfaces/UseBaseQueryOptions.md @@ -65,11 +65,11 @@ The type of your `queryKey`. | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: \{ `client`: `QueryClient`; `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: `QueryClient`; `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| `NonFunctionGuard`\<`TQueryData`\> \| ((`previousData`: `NonFunctionGuard`\<`TQueryData`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<`NonFunctionGuard`\<`TQueryData`\>, `TError`, `NonFunctionGuard`\<`TQueryData`\>, `TQueryKey`\> \| `undefined`) => `NonFunctionGuard`\<`TQueryData`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | -| `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: `object`) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | +| `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: \{ `client`: `QueryClient`; `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `TQueryKey`; `signal`: `AbortSignal`; \}) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `reconcile?` | \| `string` \| `false` \| ((`oldData`: `TData` \| `undefined`, `newData`: `TData`) => `TData`) | `undefined` | Set this to a reconciliation key to enable reconciliation between query results. Set this to `false` to disable reconciliation between query results. Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom reconciliation logic. Defaults reconciliation to false. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, `TQueryData`, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | diff --git a/docs/framework/solid/reference/type-aliases/AnyDataTag.md b/docs/framework/solid/reference/type-aliases/AnyDataTag.md index 4b9304ed2ee..65d582ac8aa 100644 --- a/docs/framework/solid/reference/type-aliases/AnyDataTag.md +++ b/docs/framework/solid/reference/type-aliases/AnyDataTag.md @@ -6,7 +6,10 @@ title: AnyDataTag ```ts -type AnyDataTag = object; +type AnyDataTag = { + [dataTagErrorSymbol]: any; + [dataTagSymbol]: any; +}; ``` Defined in: [packages/query-core/src/types.ts:122](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L122) diff --git a/docs/framework/solid/reference/type-aliases/DataTag.md b/docs/framework/solid/reference/type-aliases/DataTag.md index 6e5cbfd46b9..22389c45a62 100644 --- a/docs/framework/solid/reference/type-aliases/DataTag.md +++ b/docs/framework/solid/reference/type-aliases/DataTag.md @@ -6,7 +6,10 @@ title: DataTag ```ts -type DataTag = TType extends AnyDataTag ? TType : TType & object; +type DataTag = TType extends AnyDataTag ? TType : TType & { + [dataTagErrorSymbol]: TError; + [dataTagSymbol]: TValue; +}; ``` Defined in: [packages/query-core/src/types.ts:137](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L137) diff --git a/docs/framework/solid/reference/type-aliases/DefaultError.md b/docs/framework/solid/reference/type-aliases/DefaultError.md index 85150115168..1db2fd40ed7 100644 --- a/docs/framework/solid/reference/type-aliases/DefaultError.md +++ b/docs/framework/solid/reference/type-aliases/DefaultError.md @@ -6,7 +6,9 @@ title: DefaultError ```ts -type DefaultError = Register extends object ? TError : Error; +type DefaultError = Register extends { + defaultError: infer TError; +} ? TError : Error; ``` Defined in: [packages/query-core/src/types.ts:83](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L83) diff --git a/docs/framework/solid/reference/type-aliases/DefinedInitialDataInfiniteOptions.md b/docs/framework/solid/reference/type-aliases/DefinedInitialDataInfiniteOptions.md index 04e2912a146..9334960e9d5 100644 --- a/docs/framework/solid/reference/type-aliases/DefinedInitialDataInfiniteOptions.md +++ b/docs/framework/solid/reference/type-aliases/DefinedInitialDataInfiniteOptions.md @@ -6,7 +6,10 @@ title: DefinedInitialDataInfiniteOptions ```ts -type DefinedInitialDataInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = Accessor & object>; +type DefinedInitialDataInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = Accessor & { + initialData: | NonUndefinedGuard> + | (() => NonUndefinedGuard>); +}>; ``` Defined in: [packages/solid-query/src/infiniteQueryOptions.ts:46](https://github.com/TanStack/query/blob/main/packages/solid-query/src/infiniteQueryOptions.ts#L46) diff --git a/docs/framework/solid/reference/type-aliases/DefinedInitialDataOptions.md b/docs/framework/solid/reference/type-aliases/DefinedInitialDataOptions.md index e771bc53daf..5bdf3141ef7 100644 --- a/docs/framework/solid/reference/type-aliases/DefinedInitialDataOptions.md +++ b/docs/framework/solid/reference/type-aliases/DefinedInitialDataOptions.md @@ -6,7 +6,9 @@ title: DefinedInitialDataOptions ```ts -type DefinedInitialDataOptions = Accessor & object>; +type DefinedInitialDataOptions = Accessor & { + initialData: TQueryFnData | (() => TQueryFnData); +}>; ``` Defined in: [packages/solid-query/src/queryOptions.ts:38](https://github.com/TanStack/query/blob/main/packages/solid-query/src/queryOptions.ts#L38) diff --git a/docs/framework/solid/reference/type-aliases/EnsureInfiniteQueryDataOptions.md b/docs/framework/solid/reference/type-aliases/EnsureInfiniteQueryDataOptions.md index 1142c9bf005..d9c876a6029 100644 --- a/docs/framework/solid/reference/type-aliases/EnsureInfiniteQueryDataOptions.md +++ b/docs/framework/solid/reference/type-aliases/EnsureInfiniteQueryDataOptions.md @@ -6,7 +6,9 @@ title: EnsureInfiniteQueryDataOptions ```ts -type EnsureInfiniteQueryDataOptions = FetchInfiniteQueryOptions & object; +type EnsureInfiniteQueryDataOptions = FetchInfiniteQueryOptions & { + revalidateIfStale?: boolean; +}; ``` Defined in: [packages/query-core/src/types.ts:794](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L794) diff --git a/docs/framework/solid/reference/type-aliases/MutationFunctionContext.md b/docs/framework/solid/reference/type-aliases/MutationFunctionContext.md index cc52d82ee47..ec371ef8d09 100644 --- a/docs/framework/solid/reference/type-aliases/MutationFunctionContext.md +++ b/docs/framework/solid/reference/type-aliases/MutationFunctionContext.md @@ -6,7 +6,11 @@ title: MutationFunctionContext ```ts -type MutationFunctionContext = object; +type MutationFunctionContext = { + client: QueryClient; + meta: MutationMeta | undefined; + mutationKey?: MutationKey; +}; ``` Defined in: [packages/query-core/src/types.ts:1855](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1855) diff --git a/docs/framework/solid/reference/type-aliases/MutationKey.md b/docs/framework/solid/reference/type-aliases/MutationKey.md index 7c598833c16..372431c32fb 100644 --- a/docs/framework/solid/reference/type-aliases/MutationKey.md +++ b/docs/framework/solid/reference/type-aliases/MutationKey.md @@ -6,7 +6,9 @@ title: MutationKey ```ts -type MutationKey = Register extends object ? TMutationKey extends ReadonlyArray ? TMutationKey : TMutationKey extends unknown[] ? TMutationKey : ReadonlyArray : ReadonlyArray; +type MutationKey = Register extends { + mutationKey: infer TMutationKey; +} ? TMutationKey extends ReadonlyArray ? TMutationKey : TMutationKey extends unknown[] ? TMutationKey : ReadonlyArray : ReadonlyArray; ``` Defined in: [packages/query-core/src/types.ts:1814](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1814) diff --git a/docs/framework/solid/reference/type-aliases/MutationMeta.md b/docs/framework/solid/reference/type-aliases/MutationMeta.md index 2b7dc7446ae..ddac47dcfc4 100644 --- a/docs/framework/solid/reference/type-aliases/MutationMeta.md +++ b/docs/framework/solid/reference/type-aliases/MutationMeta.md @@ -6,7 +6,9 @@ title: MutationMeta ```ts -type MutationMeta = Register extends object ? TMutationMeta extends Record ? TMutationMeta : Record : Record; +type MutationMeta = Register extends { + mutationMeta: infer TMutationMeta; +} ? TMutationMeta extends Record ? TMutationMeta : Record : Record; ``` Defined in: [packages/query-core/src/types.ts:1843](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1843) diff --git a/docs/framework/solid/reference/type-aliases/MutationScope.md b/docs/framework/solid/reference/type-aliases/MutationScope.md index 4357b2d629d..f859dc913a9 100644 --- a/docs/framework/solid/reference/type-aliases/MutationScope.md +++ b/docs/framework/solid/reference/type-aliases/MutationScope.md @@ -6,7 +6,9 @@ title: MutationScope ```ts -type MutationScope = object; +type MutationScope = { + id: string; +}; ``` Defined in: [packages/query-core/src/types.ts:1832](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1832) diff --git a/docs/framework/solid/reference/type-aliases/QueryClientProviderProps.md b/docs/framework/solid/reference/type-aliases/QueryClientProviderProps.md index e6a609875a2..d77bcd2452e 100644 --- a/docs/framework/solid/reference/type-aliases/QueryClientProviderProps.md +++ b/docs/framework/solid/reference/type-aliases/QueryClientProviderProps.md @@ -6,7 +6,10 @@ title: QueryClientProviderProps ```ts -type QueryClientProviderProps = object; +type QueryClientProviderProps = { + children?: JSX.Element; + client: QueryClient; +}; ``` Defined in: [packages/solid-query/src/QueryClientProvider.tsx:69](https://github.com/TanStack/query/blob/main/packages/solid-query/src/QueryClientProvider.tsx#L69) diff --git a/docs/framework/solid/reference/type-aliases/QueryFunctionContext.md b/docs/framework/solid/reference/type-aliases/QueryFunctionContext.md index 15a8d2e9261..59324fb3aeb 100644 --- a/docs/framework/solid/reference/type-aliases/QueryFunctionContext.md +++ b/docs/framework/solid/reference/type-aliases/QueryFunctionContext.md @@ -6,7 +6,21 @@ title: QueryFunctionContext ```ts -type QueryFunctionContext = [TPageParam] extends [never] ? object : object; +type QueryFunctionContext = [TPageParam] extends [never] ? { + client: QueryClient; + direction?: unknown; + meta: QueryMeta | undefined; + pageParam?: unknown; + queryKey: TQueryKey; + signal: AbortSignal; +} : { + client: QueryClient; + direction: FetchDirection; + meta: QueryMeta | undefined; + pageParam: TPageParam; + queryKey: TQueryKey; + signal: AbortSignal; +}; ``` Defined in: [packages/query-core/src/types.ts:235](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L235) diff --git a/docs/framework/solid/reference/type-aliases/QueryKey.md b/docs/framework/solid/reference/type-aliases/QueryKey.md index 6a2c8ca5503..d358486f29b 100644 --- a/docs/framework/solid/reference/type-aliases/QueryKey.md +++ b/docs/framework/solid/reference/type-aliases/QueryKey.md @@ -6,7 +6,9 @@ title: QueryKey ```ts -type QueryKey = Register extends object ? TQueryKey extends ReadonlyArray ? TQueryKey : TQueryKey extends unknown[] ? TQueryKey : ReadonlyArray : ReadonlyArray; +type QueryKey = Register extends { + queryKey: infer TQueryKey; +} ? TQueryKey extends ReadonlyArray ? TQueryKey : TQueryKey extends unknown[] ? TQueryKey : ReadonlyArray : ReadonlyArray; ``` Defined in: [packages/query-core/src/types.ts:93](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L93) diff --git a/docs/framework/solid/reference/type-aliases/QueryKeyWithDataTag.md b/docs/framework/solid/reference/type-aliases/QueryKeyWithDataTag.md index 60244136ec1..f4c0ab86c9a 100644 --- a/docs/framework/solid/reference/type-aliases/QueryKeyWithDataTag.md +++ b/docs/framework/solid/reference/type-aliases/QueryKeyWithDataTag.md @@ -6,7 +6,9 @@ title: QueryKeyWithDataTag ```ts -type QueryKeyWithDataTag = object; +type QueryKeyWithDataTag = { + queryKey: DataTag; +}; ``` Defined in: [packages/query-core/src/types.ts:152](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L152) diff --git a/docs/framework/solid/reference/type-aliases/QueryMeta.md b/docs/framework/solid/reference/type-aliases/QueryMeta.md index 3df2e5a17bd..6f1b27a3d9e 100644 --- a/docs/framework/solid/reference/type-aliases/QueryMeta.md +++ b/docs/framework/solid/reference/type-aliases/QueryMeta.md @@ -6,7 +6,9 @@ title: QueryMeta ```ts -type QueryMeta = Register extends object ? TQueryMeta extends Record ? TQueryMeta : Record : Record; +type QueryMeta = Register extends { + queryMeta: infer TQueryMeta; +} ? TQueryMeta extends Record ? TQueryMeta : Record : Record; ``` Defined in: [packages/query-core/src/types.ts:330](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L330) diff --git a/docs/framework/solid/reference/type-aliases/TimeoutProvider.md b/docs/framework/solid/reference/type-aliases/TimeoutProvider.md index 6e3fd194540..88cd72aa7e3 100644 --- a/docs/framework/solid/reference/type-aliases/TimeoutProvider.md +++ b/docs/framework/solid/reference/type-aliases/TimeoutProvider.md @@ -6,7 +6,12 @@ title: TimeoutProvider ```ts -type TimeoutProvider = object; +type TimeoutProvider = { + clearInterval: (intervalId: TTimerId | undefined) => void; + clearTimeout: (timeoutId: TTimerId | undefined) => void; + setInterval: (callback: TimeoutCallback, delay: number) => TTimerId; + setTimeout: (callback: TimeoutCallback, delay: number) => TTimerId; +}; ``` Defined in: [packages/query-core/src/timeoutManager.ts:28](https://github.com/TanStack/query/blob/main/packages/query-core/src/timeoutManager.ts#L28) diff --git a/docs/framework/solid/reference/type-aliases/UndefinedInitialDataInfiniteOptions.md b/docs/framework/solid/reference/type-aliases/UndefinedInitialDataInfiniteOptions.md index 98cd507b4a8..0123d11a4c3 100644 --- a/docs/framework/solid/reference/type-aliases/UndefinedInitialDataInfiniteOptions.md +++ b/docs/framework/solid/reference/type-aliases/UndefinedInitialDataInfiniteOptions.md @@ -6,7 +6,9 @@ title: UndefinedInitialDataInfiniteOptions ```ts -type UndefinedInitialDataInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = Accessor & object>; +type UndefinedInitialDataInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = Accessor & { + initialData?: undefined; +}>; ``` Defined in: [packages/solid-query/src/infiniteQueryOptions.ts:24](https://github.com/TanStack/query/blob/main/packages/solid-query/src/infiniteQueryOptions.ts#L24) diff --git a/docs/framework/solid/reference/type-aliases/UndefinedInitialDataOptions.md b/docs/framework/solid/reference/type-aliases/UndefinedInitialDataOptions.md index 2f2aa8af511..7d087f57350 100644 --- a/docs/framework/solid/reference/type-aliases/UndefinedInitialDataOptions.md +++ b/docs/framework/solid/reference/type-aliases/UndefinedInitialDataOptions.md @@ -6,7 +6,9 @@ title: UndefinedInitialDataOptions ```ts -type UndefinedInitialDataOptions = Accessor & object>; +type UndefinedInitialDataOptions = Accessor & { + initialData?: undefined; +}>; ``` Defined in: [packages/solid-query/src/queryOptions.ts:19](https://github.com/TanStack/query/blob/main/packages/solid-query/src/queryOptions.ts#L19) diff --git a/docs/framework/solid/reference/type-aliases/UseBaseMutationResult.md b/docs/framework/solid/reference/type-aliases/UseBaseMutationResult.md index 9e53082ac08..696ee4a992f 100644 --- a/docs/framework/solid/reference/type-aliases/UseBaseMutationResult.md +++ b/docs/framework/solid/reference/type-aliases/UseBaseMutationResult.md @@ -8,7 +8,9 @@ title: UseBaseMutationResult ```ts type UseBaseMutationResult = Override, { mutate: UseMutateFunction; -}> & object; +}> & { + mutateAsync: UseMutateAsyncFunction; +}; ``` Defined in: [packages/solid-query/src/types.ts:312](https://github.com/TanStack/query/blob/main/packages/solid-query/src/types.ts#L312) diff --git a/docs/framework/solid/reference/variables/environmentManager.md b/docs/framework/solid/reference/variables/environmentManager.md index 40b82d3a2de..4e8224270d3 100644 --- a/docs/framework/solid/reference/variables/environmentManager.md +++ b/docs/framework/solid/reference/variables/environmentManager.md @@ -6,7 +6,10 @@ title: environmentManager ```ts -const environmentManager: object; +const environmentManager: { + isServer: () => boolean; + setIsServer(isServerValue: IsServerValue): void; +}; ``` Defined in: [packages/query-core/src/environmentManager.ts:32](https://github.com/TanStack/query/blob/main/packages/query-core/src/environmentManager.ts#L32) diff --git a/docs/framework/solid/reference/variables/notifyManager.md b/docs/framework/solid/reference/variables/notifyManager.md index 82290f7f19a..5ddda37894d 100644 --- a/docs/framework/solid/reference/variables/notifyManager.md +++ b/docs/framework/solid/reference/variables/notifyManager.md @@ -6,7 +6,14 @@ title: notifyManager ```ts -const notifyManager: object; +const notifyManager: { + batch: (callback: () => T) => T; + batchCalls: (callback: BatchCallsCallback) => BatchCallsCallback; + schedule: (callback: NotifyCallback) => void; + setBatchNotifyFunction: (fn: BatchNotifyFunction) => void; + setNotifyFunction: (fn: NotifyFunction) => void; + setScheduler: (fn: ScheduleFunction) => void; +}; ``` Defined in: [packages/query-core/src/notifyManager.ts:154](https://github.com/TanStack/query/blob/main/packages/query-core/src/notifyManager.ts#L154) diff --git a/docs/framework/svelte/reference/functions/createInfiniteQuery.md b/docs/framework/svelte/reference/functions/createInfiniteQuery.md index f74e6d2fdae..5f98555a201 100644 --- a/docs/framework/svelte/reference/functions/createInfiniteQuery.md +++ b/docs/framework/svelte/reference/functions/createInfiniteQuery.md @@ -323,11 +323,11 @@ The [CreateInfiniteQueryOptions](../type-aliases/CreateInfiniteQueryOptions.md) | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| ((`previousData`: \| [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<[`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TError`, [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\> \| `undefined`) => \| [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, [`InfiniteData`](../interfaces/InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/svelte/reference/functions/createQuery.md b/docs/framework/svelte/reference/functions/createQuery.md index c5996777e02..7aa11a42fc4 100644 --- a/docs/framework/svelte/reference/functions/createQuery.md +++ b/docs/framework/svelte/reference/functions/createQuery.md @@ -401,11 +401,11 @@ in an [Accessor](../type-aliases/Accessor.md) so options can be reactive. | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| `NonFunctionGuard`\<`TQueryData`\> \| ((`previousData`: `NonFunctionGuard`\<`TQueryData`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<`NonFunctionGuard`\<`TQueryData`\>, `TError`, `NonFunctionGuard`\<`TQueryData`\>, `TQueryKey`\> \| `undefined`) => `NonFunctionGuard`\<`TQueryData`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, `TQueryData`, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/svelte/reference/functions/experimental_streamedQuery.md b/docs/framework/svelte/reference/functions/experimental_streamedQuery.md index 38ca68beefc..0ab1af0aa52 100644 --- a/docs/framework/svelte/reference/functions/experimental_streamedQuery.md +++ b/docs/framework/svelte/reference/functions/experimental_streamedQuery.md @@ -6,7 +6,14 @@ title: experimental_streamedQuery ```ts -function experimental_streamedQuery(options: StreamedQueryParams): (context: object) => TData | Promise; +function experimental_streamedQuery(options: StreamedQueryParams): (context: { + client: QueryClient; + direction?: unknown; + meta: Record | undefined; + pageParam?: unknown; + queryKey: TQueryKey; + signal: AbortSignal; +}) => TData | Promise; ``` Defined in: [packages/query-core/src/streamedQuery.ts:70](https://github.com/TanStack/query/blob/main/packages/query-core/src/streamedQuery.ts#L70) @@ -43,7 +50,14 @@ The `streamFn` that returns an AsyncIterable to stream data from, and the option A query function to pass as `queryFn`. -(`context`: `object`) => `TData` \| `Promise`\<`TData`\> +(`context`: \{ + `client`: [`QueryClient`](../classes/QueryClient.md); + `direction?`: `unknown`; + `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; + `pageParam?`: `unknown`; + `queryKey`: `TQueryKey`; + `signal`: `AbortSignal`; +\}) => `TData` \| `Promise`\<`TData`\> ## Example diff --git a/docs/framework/svelte/reference/functions/hydrate.md b/docs/framework/svelte/reference/functions/hydrate.md index 411978a70f8..aa8ca8ffd6e 100644 --- a/docs/framework/svelte/reference/functions/hydrate.md +++ b/docs/framework/svelte/reference/functions/hydrate.md @@ -56,7 +56,7 @@ client's `defaultOptions.hydrate`), and `deserializeData` to reverse `serializeD | Property | Type | Description | | ------ | ------ | ------ | -| `defaultOptions?` | `object` | Options applied to the queries and mutations restored from the dehydrated state. | +| `defaultOptions?` | \{ `deserializeData?`: `TransformerFn`; `mutations?`: [`MutationOptions`](../interfaces/MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: [`QueryOptions`](../interfaces/QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \} | Options applied to the queries and mutations restored from the dehydrated state. | | `defaultOptions.deserializeData?` | `TransformerFn` | Transforms a query's `data` after it is read from the dehydrated state, reversing `serializeData`. | | `defaultOptions.mutations?` | [`MutationOptions`](../interfaces/MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\> | Default options merged into every mutation restored from the dehydrated state. | | `defaultOptions.queries?` | [`QueryOptions`](../interfaces/QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\> | Default options merged into every query restored from the dehydrated state. | diff --git a/docs/framework/svelte/reference/functions/useHydrate.md b/docs/framework/svelte/reference/functions/useHydrate.md index ec5e29d0191..dbc3eaad020 100644 --- a/docs/framework/svelte/reference/functions/useHydrate.md +++ b/docs/framework/svelte/reference/functions/useHydrate.md @@ -40,7 +40,7 @@ The dehydrated state to hydrate into the cache, as produced by `dehydrate`. | Property | Type | Description | | ------ | ------ | ------ | -| `defaultOptions?` | `object` | Options applied to the queries and mutations restored from the dehydrated state. | +| `defaultOptions?` | \{ `deserializeData?`: `TransformerFn`; `mutations?`: [`MutationOptions`](../interfaces/MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: [`QueryOptions`](../interfaces/QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \} | Options applied to the queries and mutations restored from the dehydrated state. | | `defaultOptions.deserializeData?` | `TransformerFn` | Transforms a query's `data` after it is read from the dehydrated state, reversing `serializeData`. | | `defaultOptions.mutations?` | [`MutationOptions`](../interfaces/MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\> | Default options merged into every mutation restored from the dehydrated state. | | `defaultOptions.queries?` | [`QueryOptions`](../interfaces/QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\> | Default options merged into every query restored from the dehydrated state. | diff --git a/docs/framework/svelte/reference/interfaces/DefaultOptions.md b/docs/framework/svelte/reference/interfaces/DefaultOptions.md index 25628a573fb..f26d4b5519c 100644 --- a/docs/framework/svelte/reference/interfaces/DefaultOptions.md +++ b/docs/framework/svelte/reference/interfaces/DefaultOptions.md @@ -21,7 +21,7 @@ The default options of a `QueryClient`, applied to every query (`queries`), muta | Property | Type | Description | | ------ | ------ | ------ | | `dehydrate?` | [`DehydrateOptions`](DehydrateOptions.md) | Default options used when dehydrating the client's caches; see [DehydrateOptions](DehydrateOptions.md). | -| `hydrate?` | `object` | Default options used when hydrating queries and mutations; see [HydrateOptions](HydrateOptions.md). | +| `hydrate?` | \{ `deserializeData?`: `TransformerFn`; `mutations?`: [`MutationOptions`](MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: [`QueryOptions`](QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \} | Default options used when hydrating queries and mutations; see [HydrateOptions](HydrateOptions.md). | | `hydrate.deserializeData?` | `TransformerFn` | Transforms a query's `data` after it is read from the dehydrated state, reversing `serializeData`. | | `hydrate.mutations?` | [`MutationOptions`](MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\> | Default options merged into every mutation restored from the dehydrated state. | | `hydrate.queries?` | [`QueryOptions`](QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\> | Default options merged into every query restored from the dehydrated state. | diff --git a/docs/framework/svelte/reference/interfaces/EnsureQueryDataOptions.md b/docs/framework/svelte/reference/interfaces/EnsureQueryDataOptions.md index 489415d5d37..8ab6c8bf8b8 100644 --- a/docs/framework/svelte/reference/interfaces/EnsureQueryDataOptions.md +++ b/docs/framework/svelte/reference/interfaces/EnsureQueryDataOptions.md @@ -46,10 +46,10 @@ Defined in: [packages/query-core/src/types.ts:774](https://github.com/TanStack/q | ~~`maxPages?`~~ | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | ~~`meta?`~~ | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | ~~`networkMode?`~~ | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | ~~`queryFn?`~~ | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | ~~`queryHash?`~~ | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| ~~`queryKey`~~ | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| ~~`queryKey`~~ | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | ~~`queryKeyHashFn?`~~ | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | ~~`retry?`~~ | \| `number` \| `false` \| `true` \| ((`failureCount`: `number`, `error`: `TError`) => `boolean`) | `undefined` | If `false`, failed queries will not retry by default. If `true`, failed queries will retry infinitely. If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number. If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false. Defaults to `3` on the client and `0` on the server. | | ~~`retryDelay?`~~ | `number` \| ((`failureCount`: `number`, `error`: `TError`) => `number`) | `undefined` | This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. A function like `attempt => attempt * 1000` applies linear backoff. Defaults to a function that applies exponential backoff, capped at 30 seconds. | diff --git a/docs/framework/svelte/reference/interfaces/FetchQueryOptions.md b/docs/framework/svelte/reference/interfaces/FetchQueryOptions.md index 5a288291ebd..d6fcdc3ef78 100644 --- a/docs/framework/svelte/reference/interfaces/FetchQueryOptions.md +++ b/docs/framework/svelte/reference/interfaces/FetchQueryOptions.md @@ -50,10 +50,10 @@ Defined in: [packages/query-core/src/types.ts:752](https://github.com/TanStack/q | ~~`maxPages?`~~ | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | ~~`meta?`~~ | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | ~~`networkMode?`~~ | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | ~~`queryFn?`~~ | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | ~~`queryHash?`~~ | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| ~~`queryKey`~~ | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| ~~`queryKey`~~ | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | ~~`queryKeyHashFn?`~~ | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | ~~`retry?`~~ | \| `number` \| `false` \| `true` \| ((`failureCount`: `number`, `error`: `TError`) => `boolean`) | `undefined` | If `false`, failed queries will not retry by default. If `true`, failed queries will retry infinitely. If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number. If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false. Defaults to `3` on the client and `0` on the server. | | ~~`retryDelay?`~~ | `number` \| ((`failureCount`: `number`, `error`: `TError`) => `number`) | `undefined` | This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. A function like `attempt => attempt * 1000` applies linear backoff. Defaults to a function that applies exponential backoff, capped at 30 seconds. | diff --git a/docs/framework/svelte/reference/interfaces/HydrateOptions.md b/docs/framework/svelte/reference/interfaces/HydrateOptions.md index f070f729ff9..1dd5de960ae 100644 --- a/docs/framework/svelte/reference/interfaces/HydrateOptions.md +++ b/docs/framework/svelte/reference/interfaces/HydrateOptions.md @@ -14,7 +14,7 @@ Options for `hydrate`, controlling the default options applied to queries/mutati | Property | Type | Description | | ------ | ------ | ------ | -| `defaultOptions?` | `object` | Options applied to the queries and mutations restored from the dehydrated state. | +| `defaultOptions?` | \{ `deserializeData?`: `TransformerFn`; `mutations?`: [`MutationOptions`](MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: [`QueryOptions`](QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \} | Options applied to the queries and mutations restored from the dehydrated state. | | `defaultOptions.deserializeData?` | `TransformerFn` | Transforms a query's `data` after it is read from the dehydrated state, reversing `serializeData`. | | `defaultOptions.mutations?` | [`MutationOptions`](MutationOptions.md)\<`unknown`, `Error`, `unknown`, `unknown`\> | Default options merged into every mutation restored from the dehydrated state. | | `defaultOptions.queries?` | [`QueryOptions`](QueryOptions.md)\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\> | Default options merged into every query restored from the dehydrated state. | diff --git a/docs/framework/svelte/reference/interfaces/InfiniteQueryObserverOptions.md b/docs/framework/svelte/reference/interfaces/InfiniteQueryObserverOptions.md index 418e3d41ebf..c8cbb098e8a 100644 --- a/docs/framework/svelte/reference/interfaces/InfiniteQueryObserverOptions.md +++ b/docs/framework/svelte/reference/interfaces/InfiniteQueryObserverOptions.md @@ -52,11 +52,11 @@ The options of an `InfiniteQueryObserver`: [QueryObserverOptions](QueryObserverO | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| ((`previousData`: \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<[`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TError`, [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\> \| `undefined`) => \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/svelte/reference/interfaces/QueryExecuteOptions.md b/docs/framework/svelte/reference/interfaces/QueryExecuteOptions.md index a14c79bfc19..0f472791f1e 100644 --- a/docs/framework/svelte/reference/interfaces/QueryExecuteOptions.md +++ b/docs/framework/svelte/reference/interfaces/QueryExecuteOptions.md @@ -52,10 +52,10 @@ transforms the value the call resolves with. | `maxPages?` | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `retry?` | \| `number` \| `false` \| `true` \| ((`failureCount`: `number`, `error`: `TError`) => `boolean`) | `undefined` | If `false`, failed queries will not retry by default. If `true`, failed queries will retry infinitely. If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number. If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false. Defaults to `3` on the client and `0` on the server. | | `retryDelay?` | `number` \| ((`failureCount`: `number`, `error`: `TError`) => `number`) | `undefined` | This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. A function like `attempt => attempt * 1000` applies linear backoff. Defaults to a function that applies exponential backoff, capped at 30 seconds. | diff --git a/docs/framework/svelte/reference/interfaces/QueryObserverOptions.md b/docs/framework/svelte/reference/interfaces/QueryObserverOptions.md index eb842bc6f56..2f426489dee 100644 --- a/docs/framework/svelte/reference/interfaces/QueryObserverOptions.md +++ b/docs/framework/svelte/reference/interfaces/QueryObserverOptions.md @@ -57,11 +57,11 @@ The options of a `QueryObserver`, and of the hooks built on it like `useQuery`: | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| `NonFunctionGuard`\<`TQueryData`\> \| ((`previousData`: `NonFunctionGuard`\<`TQueryData`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<`NonFunctionGuard`\<`TQueryData`\>, `TError`, `NonFunctionGuard`\<`TQueryData`\>, `TQueryKey`\> \| `undefined`) => `NonFunctionGuard`\<`TQueryData`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, `TQueryData`, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/svelte/reference/interfaces/QueryOptions.md b/docs/framework/svelte/reference/interfaces/QueryOptions.md index 574f08b670a..72c9a70ab0e 100644 --- a/docs/framework/svelte/reference/interfaces/QueryOptions.md +++ b/docs/framework/svelte/reference/interfaces/QueryOptions.md @@ -42,7 +42,7 @@ The options of a query itself — its `queryKey`, `queryFn`, retries, `gcTime`, | `maxPages?` | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: [`QueryClient`](../classes/QueryClient.md); `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `queryFn?` | \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) \| *typeof* [`skipToken`](../variables/skipToken.md) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | | `queryKey?` | `TQueryKey` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | diff --git a/docs/framework/svelte/reference/type-aliases/AnyDataTag.md b/docs/framework/svelte/reference/type-aliases/AnyDataTag.md index 4b9304ed2ee..65d582ac8aa 100644 --- a/docs/framework/svelte/reference/type-aliases/AnyDataTag.md +++ b/docs/framework/svelte/reference/type-aliases/AnyDataTag.md @@ -6,7 +6,10 @@ title: AnyDataTag ```ts -type AnyDataTag = object; +type AnyDataTag = { + [dataTagErrorSymbol]: any; + [dataTagSymbol]: any; +}; ``` Defined in: [packages/query-core/src/types.ts:122](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L122) diff --git a/docs/framework/svelte/reference/type-aliases/CreateBaseMutationResult.md b/docs/framework/svelte/reference/type-aliases/CreateBaseMutationResult.md index 4d8b14d195d..738d56930c5 100644 --- a/docs/framework/svelte/reference/type-aliases/CreateBaseMutationResult.md +++ b/docs/framework/svelte/reference/type-aliases/CreateBaseMutationResult.md @@ -8,7 +8,9 @@ title: CreateBaseMutationResult ```ts type CreateBaseMutationResult = Override, { mutate: CreateMutateFunction; -}> & object; +}> & { + mutateAsync: CreateMutateAsyncFunction; +}; ``` Defined in: [packages/svelte-query/src/types.ts:139](https://github.com/TanStack/query/blob/main/packages/svelte-query/src/types.ts#L139) diff --git a/docs/framework/svelte/reference/type-aliases/DataTag.md b/docs/framework/svelte/reference/type-aliases/DataTag.md index 6e5cbfd46b9..22389c45a62 100644 --- a/docs/framework/svelte/reference/type-aliases/DataTag.md +++ b/docs/framework/svelte/reference/type-aliases/DataTag.md @@ -6,7 +6,10 @@ title: DataTag ```ts -type DataTag = TType extends AnyDataTag ? TType : TType & object; +type DataTag = TType extends AnyDataTag ? TType : TType & { + [dataTagErrorSymbol]: TError; + [dataTagSymbol]: TValue; +}; ``` Defined in: [packages/query-core/src/types.ts:137](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L137) diff --git a/docs/framework/svelte/reference/type-aliases/DefaultError.md b/docs/framework/svelte/reference/type-aliases/DefaultError.md index 85150115168..1db2fd40ed7 100644 --- a/docs/framework/svelte/reference/type-aliases/DefaultError.md +++ b/docs/framework/svelte/reference/type-aliases/DefaultError.md @@ -6,7 +6,9 @@ title: DefaultError ```ts -type DefaultError = Register extends object ? TError : Error; +type DefaultError = Register extends { + defaultError: infer TError; +} ? TError : Error; ``` Defined in: [packages/query-core/src/types.ts:83](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L83) diff --git a/docs/framework/svelte/reference/type-aliases/DefinedInitialDataInfiniteOptions.md b/docs/framework/svelte/reference/type-aliases/DefinedInitialDataInfiniteOptions.md index 57e1f669648..4037302df82 100644 --- a/docs/framework/svelte/reference/type-aliases/DefinedInitialDataInfiniteOptions.md +++ b/docs/framework/svelte/reference/type-aliases/DefinedInitialDataInfiniteOptions.md @@ -6,7 +6,10 @@ title: DefinedInitialDataInfiniteOptions ```ts -type DefinedInitialDataInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = CreateInfiniteQueryOptions & object; +type DefinedInitialDataInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = CreateInfiniteQueryOptions & { + initialData: | NonUndefinedGuard> + | (() => NonUndefinedGuard>); +}; ``` Defined in: [packages/svelte-query/src/infiniteQueryOptions.ts:40](https://github.com/TanStack/query/blob/main/packages/svelte-query/src/infiniteQueryOptions.ts#L40) diff --git a/docs/framework/svelte/reference/type-aliases/DefinedInitialDataOptions.md b/docs/framework/svelte/reference/type-aliases/DefinedInitialDataOptions.md index a19307053f7..8585d017da0 100644 --- a/docs/framework/svelte/reference/type-aliases/DefinedInitialDataOptions.md +++ b/docs/framework/svelte/reference/type-aliases/DefinedInitialDataOptions.md @@ -6,7 +6,10 @@ title: DefinedInitialDataOptions ```ts -type DefinedInitialDataOptions = CreateQueryOptions & object; +type DefinedInitialDataOptions = CreateQueryOptions & { + initialData: | NonUndefinedGuard + | (() => NonUndefinedGuard); +}; ``` Defined in: [packages/svelte-query/src/queryOptions.ts:30](https://github.com/TanStack/query/blob/main/packages/svelte-query/src/queryOptions.ts#L30) diff --git a/docs/framework/svelte/reference/type-aliases/EnsureInfiniteQueryDataOptions.md b/docs/framework/svelte/reference/type-aliases/EnsureInfiniteQueryDataOptions.md index 1142c9bf005..d9c876a6029 100644 --- a/docs/framework/svelte/reference/type-aliases/EnsureInfiniteQueryDataOptions.md +++ b/docs/framework/svelte/reference/type-aliases/EnsureInfiniteQueryDataOptions.md @@ -6,7 +6,9 @@ title: EnsureInfiniteQueryDataOptions ```ts -type EnsureInfiniteQueryDataOptions = FetchInfiniteQueryOptions & object; +type EnsureInfiniteQueryDataOptions = FetchInfiniteQueryOptions & { + revalidateIfStale?: boolean; +}; ``` Defined in: [packages/query-core/src/types.ts:794](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L794) diff --git a/docs/framework/svelte/reference/type-aliases/MutationFunctionContext.md b/docs/framework/svelte/reference/type-aliases/MutationFunctionContext.md index 39a5d19316a..4b2d040ca9a 100644 --- a/docs/framework/svelte/reference/type-aliases/MutationFunctionContext.md +++ b/docs/framework/svelte/reference/type-aliases/MutationFunctionContext.md @@ -6,7 +6,11 @@ title: MutationFunctionContext ```ts -type MutationFunctionContext = object; +type MutationFunctionContext = { + client: QueryClient; + meta: MutationMeta | undefined; + mutationKey?: MutationKey; +}; ``` Defined in: [packages/query-core/src/types.ts:1855](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1855) diff --git a/docs/framework/svelte/reference/type-aliases/MutationKey.md b/docs/framework/svelte/reference/type-aliases/MutationKey.md index 7c598833c16..372431c32fb 100644 --- a/docs/framework/svelte/reference/type-aliases/MutationKey.md +++ b/docs/framework/svelte/reference/type-aliases/MutationKey.md @@ -6,7 +6,9 @@ title: MutationKey ```ts -type MutationKey = Register extends object ? TMutationKey extends ReadonlyArray ? TMutationKey : TMutationKey extends unknown[] ? TMutationKey : ReadonlyArray : ReadonlyArray; +type MutationKey = Register extends { + mutationKey: infer TMutationKey; +} ? TMutationKey extends ReadonlyArray ? TMutationKey : TMutationKey extends unknown[] ? TMutationKey : ReadonlyArray : ReadonlyArray; ``` Defined in: [packages/query-core/src/types.ts:1814](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1814) diff --git a/docs/framework/svelte/reference/type-aliases/MutationMeta.md b/docs/framework/svelte/reference/type-aliases/MutationMeta.md index 2b7dc7446ae..ddac47dcfc4 100644 --- a/docs/framework/svelte/reference/type-aliases/MutationMeta.md +++ b/docs/framework/svelte/reference/type-aliases/MutationMeta.md @@ -6,7 +6,9 @@ title: MutationMeta ```ts -type MutationMeta = Register extends object ? TMutationMeta extends Record ? TMutationMeta : Record : Record; +type MutationMeta = Register extends { + mutationMeta: infer TMutationMeta; +} ? TMutationMeta extends Record ? TMutationMeta : Record : Record; ``` Defined in: [packages/query-core/src/types.ts:1843](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1843) diff --git a/docs/framework/svelte/reference/type-aliases/MutationScope.md b/docs/framework/svelte/reference/type-aliases/MutationScope.md index 4357b2d629d..f859dc913a9 100644 --- a/docs/framework/svelte/reference/type-aliases/MutationScope.md +++ b/docs/framework/svelte/reference/type-aliases/MutationScope.md @@ -6,7 +6,9 @@ title: MutationScope ```ts -type MutationScope = object; +type MutationScope = { + id: string; +}; ``` Defined in: [packages/query-core/src/types.ts:1832](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1832) diff --git a/docs/framework/svelte/reference/type-aliases/MutationStateOptions.md b/docs/framework/svelte/reference/type-aliases/MutationStateOptions.md index 53b1c000011..2eff6a8b669 100644 --- a/docs/framework/svelte/reference/type-aliases/MutationStateOptions.md +++ b/docs/framework/svelte/reference/type-aliases/MutationStateOptions.md @@ -6,7 +6,10 @@ title: MutationStateOptions ```ts -type MutationStateOptions = MutationTypeFromResult> = object; +type MutationStateOptions = MutationTypeFromResult> = { + filters?: MutationFilters; + select?: (mutation: TMutation) => TResult; +}; ``` Defined in: [packages/svelte-query/src/types.ts:180](https://github.com/TanStack/query/blob/main/packages/svelte-query/src/types.ts#L180) diff --git a/docs/framework/svelte/reference/type-aliases/QueryClientProviderProps.md b/docs/framework/svelte/reference/type-aliases/QueryClientProviderProps.md index fd4c395a583..e5bb7393ad1 100644 --- a/docs/framework/svelte/reference/type-aliases/QueryClientProviderProps.md +++ b/docs/framework/svelte/reference/type-aliases/QueryClientProviderProps.md @@ -6,7 +6,10 @@ title: QueryClientProviderProps ```ts -type QueryClientProviderProps = object; +type QueryClientProviderProps = { + children: Snippet; + client: QueryClient; +}; ``` Defined in: [packages/svelte-query/src/types.ts:198](https://github.com/TanStack/query/blob/main/packages/svelte-query/src/types.ts#L198) diff --git a/docs/framework/svelte/reference/type-aliases/QueryFunctionContext.md b/docs/framework/svelte/reference/type-aliases/QueryFunctionContext.md index 15a8d2e9261..59324fb3aeb 100644 --- a/docs/framework/svelte/reference/type-aliases/QueryFunctionContext.md +++ b/docs/framework/svelte/reference/type-aliases/QueryFunctionContext.md @@ -6,7 +6,21 @@ title: QueryFunctionContext ```ts -type QueryFunctionContext = [TPageParam] extends [never] ? object : object; +type QueryFunctionContext = [TPageParam] extends [never] ? { + client: QueryClient; + direction?: unknown; + meta: QueryMeta | undefined; + pageParam?: unknown; + queryKey: TQueryKey; + signal: AbortSignal; +} : { + client: QueryClient; + direction: FetchDirection; + meta: QueryMeta | undefined; + pageParam: TPageParam; + queryKey: TQueryKey; + signal: AbortSignal; +}; ``` Defined in: [packages/query-core/src/types.ts:235](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L235) diff --git a/docs/framework/svelte/reference/type-aliases/QueryKey.md b/docs/framework/svelte/reference/type-aliases/QueryKey.md index 6a2c8ca5503..d358486f29b 100644 --- a/docs/framework/svelte/reference/type-aliases/QueryKey.md +++ b/docs/framework/svelte/reference/type-aliases/QueryKey.md @@ -6,7 +6,9 @@ title: QueryKey ```ts -type QueryKey = Register extends object ? TQueryKey extends ReadonlyArray ? TQueryKey : TQueryKey extends unknown[] ? TQueryKey : ReadonlyArray : ReadonlyArray; +type QueryKey = Register extends { + queryKey: infer TQueryKey; +} ? TQueryKey extends ReadonlyArray ? TQueryKey : TQueryKey extends unknown[] ? TQueryKey : ReadonlyArray : ReadonlyArray; ``` Defined in: [packages/query-core/src/types.ts:93](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L93) diff --git a/docs/framework/svelte/reference/type-aliases/QueryKeyWithDataTag.md b/docs/framework/svelte/reference/type-aliases/QueryKeyWithDataTag.md index 60244136ec1..f4c0ab86c9a 100644 --- a/docs/framework/svelte/reference/type-aliases/QueryKeyWithDataTag.md +++ b/docs/framework/svelte/reference/type-aliases/QueryKeyWithDataTag.md @@ -6,7 +6,9 @@ title: QueryKeyWithDataTag ```ts -type QueryKeyWithDataTag = object; +type QueryKeyWithDataTag = { + queryKey: DataTag; +}; ``` Defined in: [packages/query-core/src/types.ts:152](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L152) diff --git a/docs/framework/svelte/reference/type-aliases/QueryMeta.md b/docs/framework/svelte/reference/type-aliases/QueryMeta.md index 3df2e5a17bd..6f1b27a3d9e 100644 --- a/docs/framework/svelte/reference/type-aliases/QueryMeta.md +++ b/docs/framework/svelte/reference/type-aliases/QueryMeta.md @@ -6,7 +6,9 @@ title: QueryMeta ```ts -type QueryMeta = Register extends object ? TQueryMeta extends Record ? TQueryMeta : Record : Record; +type QueryMeta = Register extends { + queryMeta: infer TQueryMeta; +} ? TQueryMeta extends Record ? TQueryMeta : Record : Record; ``` Defined in: [packages/query-core/src/types.ts:330](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L330) diff --git a/docs/framework/svelte/reference/type-aliases/TimeoutProvider.md b/docs/framework/svelte/reference/type-aliases/TimeoutProvider.md index 6e3fd194540..88cd72aa7e3 100644 --- a/docs/framework/svelte/reference/type-aliases/TimeoutProvider.md +++ b/docs/framework/svelte/reference/type-aliases/TimeoutProvider.md @@ -6,7 +6,12 @@ title: TimeoutProvider ```ts -type TimeoutProvider = object; +type TimeoutProvider = { + clearInterval: (intervalId: TTimerId | undefined) => void; + clearTimeout: (timeoutId: TTimerId | undefined) => void; + setInterval: (callback: TimeoutCallback, delay: number) => TTimerId; + setTimeout: (callback: TimeoutCallback, delay: number) => TTimerId; +}; ``` Defined in: [packages/query-core/src/timeoutManager.ts:28](https://github.com/TanStack/query/blob/main/packages/query-core/src/timeoutManager.ts#L28) diff --git a/docs/framework/svelte/reference/type-aliases/UndefinedInitialDataInfiniteOptions.md b/docs/framework/svelte/reference/type-aliases/UndefinedInitialDataInfiniteOptions.md index 21401021c1e..0d3f4a7bcb6 100644 --- a/docs/framework/svelte/reference/type-aliases/UndefinedInitialDataInfiniteOptions.md +++ b/docs/framework/svelte/reference/type-aliases/UndefinedInitialDataInfiniteOptions.md @@ -6,7 +6,10 @@ title: UndefinedInitialDataInfiniteOptions ```ts -type UndefinedInitialDataInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = CreateInfiniteQueryOptions & object; +type UndefinedInitialDataInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = CreateInfiniteQueryOptions & { + initialData?: | NonUndefinedGuard> + | InitialDataFunction>>; +}; ``` Defined in: [packages/svelte-query/src/infiniteQueryOptions.ts:15](https://github.com/TanStack/query/blob/main/packages/svelte-query/src/infiniteQueryOptions.ts#L15) diff --git a/docs/framework/svelte/reference/type-aliases/UndefinedInitialDataOptions.md b/docs/framework/svelte/reference/type-aliases/UndefinedInitialDataOptions.md index 3543bdc8303..0a0df8e0e45 100644 --- a/docs/framework/svelte/reference/type-aliases/UndefinedInitialDataOptions.md +++ b/docs/framework/svelte/reference/type-aliases/UndefinedInitialDataOptions.md @@ -6,7 +6,10 @@ title: UndefinedInitialDataOptions ```ts -type UndefinedInitialDataOptions = CreateQueryOptions & object; +type UndefinedInitialDataOptions = CreateQueryOptions & { + initialData?: | InitialDataFunction> + | NonUndefinedGuard; +}; ``` Defined in: [packages/svelte-query/src/queryOptions.ts:14](https://github.com/TanStack/query/blob/main/packages/svelte-query/src/queryOptions.ts#L14) diff --git a/docs/framework/svelte/reference/variables/environmentManager.md b/docs/framework/svelte/reference/variables/environmentManager.md index 40b82d3a2de..4e8224270d3 100644 --- a/docs/framework/svelte/reference/variables/environmentManager.md +++ b/docs/framework/svelte/reference/variables/environmentManager.md @@ -6,7 +6,10 @@ title: environmentManager ```ts -const environmentManager: object; +const environmentManager: { + isServer: () => boolean; + setIsServer(isServerValue: IsServerValue): void; +}; ``` Defined in: [packages/query-core/src/environmentManager.ts:32](https://github.com/TanStack/query/blob/main/packages/query-core/src/environmentManager.ts#L32) diff --git a/docs/framework/svelte/reference/variables/notifyManager.md b/docs/framework/svelte/reference/variables/notifyManager.md index 82290f7f19a..5ddda37894d 100644 --- a/docs/framework/svelte/reference/variables/notifyManager.md +++ b/docs/framework/svelte/reference/variables/notifyManager.md @@ -6,7 +6,14 @@ title: notifyManager ```ts -const notifyManager: object; +const notifyManager: { + batch: (callback: () => T) => T; + batchCalls: (callback: BatchCallsCallback) => BatchCallsCallback; + schedule: (callback: NotifyCallback) => void; + setBatchNotifyFunction: (fn: BatchNotifyFunction) => void; + setNotifyFunction: (fn: NotifyFunction) => void; + setScheduler: (fn: ScheduleFunction) => void; +}; ``` Defined in: [packages/query-core/src/notifyManager.ts:154](https://github.com/TanStack/query/blob/main/packages/query-core/src/notifyManager.ts#L154) diff --git a/docs/framework/vue/reference/functions/experimental_streamedQuery.md b/docs/framework/vue/reference/functions/experimental_streamedQuery.md index 38ca68beefc..2c209ebcad6 100644 --- a/docs/framework/vue/reference/functions/experimental_streamedQuery.md +++ b/docs/framework/vue/reference/functions/experimental_streamedQuery.md @@ -6,7 +6,14 @@ title: experimental_streamedQuery ```ts -function experimental_streamedQuery(options: StreamedQueryParams): (context: object) => TData | Promise; +function experimental_streamedQuery(options: StreamedQueryParams): (context: { + client: QueryClient; + direction?: unknown; + meta: Record | undefined; + pageParam?: unknown; + queryKey: TQueryKey; + signal: AbortSignal; +}) => TData | Promise; ``` Defined in: [packages/query-core/src/streamedQuery.ts:70](https://github.com/TanStack/query/blob/main/packages/query-core/src/streamedQuery.ts#L70) @@ -43,7 +50,14 @@ The `streamFn` that returns an AsyncIterable to stream data from, and the option A query function to pass as `queryFn`. -(`context`: `object`) => `TData` \| `Promise`\<`TData`\> +(`context`: \{ + `client`: `QueryClient`; + `direction?`: `unknown`; + `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; + `pageParam?`: `unknown`; + `queryKey`: `TQueryKey`; + `signal`: `AbortSignal`; +\}) => `TData` \| `Promise`\<`TData`\> ## Example diff --git a/docs/framework/vue/reference/functions/hydrate.md b/docs/framework/vue/reference/functions/hydrate.md index 568e1a226ff..8c3a8b2213e 100644 --- a/docs/framework/vue/reference/functions/hydrate.md +++ b/docs/framework/vue/reference/functions/hydrate.md @@ -56,7 +56,7 @@ client's `defaultOptions.hydrate`), and `deserializeData` to reverse `serializeD | Property | Type | Description | | ------ | ------ | ------ | -| `defaultOptions?` | `object` | Options applied to the queries and mutations restored from the dehydrated state. | +| `defaultOptions?` | \{ `deserializeData?`: `TransformerFn`; `mutations?`: `MutationOptions`\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: `QueryOptions`\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \} | Options applied to the queries and mutations restored from the dehydrated state. | | `defaultOptions.deserializeData?` | `TransformerFn` | Transforms a query's `data` after it is read from the dehydrated state, reversing `serializeData`. | | `defaultOptions.mutations?` | `MutationOptions`\<`unknown`, `Error`, `unknown`, `unknown`\> | Default options merged into every mutation restored from the dehydrated state. | | `defaultOptions.queries?` | `QueryOptions`\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\> | Default options merged into every query restored from the dehydrated state. | diff --git a/docs/framework/vue/reference/functions/useQueries.md b/docs/framework/vue/reference/functions/useQueries.md index 6eff9050f2a..04bf90a4bc6 100644 --- a/docs/framework/vue/reference/functions/useQueries.md +++ b/docs/framework/vue/reference/functions/useQueries.md @@ -8,7 +8,12 @@ redirect_from: ```ts -function useQueries] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseQueryResult, GetUseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseQueryResult, GetUseQueryResult, GetUseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : [...{ [K in string | number | symbol]: GetUseQueryResult }[]] : { [K in string | number | symbol]: GetUseQueryResult }>(options: ShallowOption & object, queryClient?: QueryClient): Readonly>; +function useQueries] : T extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseQueryResult, GetUseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...Tails[]] extends [] ? [] : [...Tails[]] extends [Head] ? [GetUseQueryResult, GetUseQueryResult, GetUseQueryResult] : [...Tails[]] extends [Head, ...Tails[]] ? [...(...)[]] extends [] ? [] : ... extends ... ? ... : ... : [...{ [K in (...)]: (...) }[]] : [...{ [K in string | number | symbol]: GetUseQueryResult }[]] : { [K in string | number | symbol]: GetUseQueryResult }>(options: ShallowOption & { + combine?: (result: UseQueriesResults) => TCombinedResult; + queries: | (() => MaybeRefDeep>) + | MaybeRefDeep> + | MaybeRefDeep }]>; +}, queryClient?: QueryClient): Readonly>; ``` Defined in: [packages/vue-query/src/useQueries.ts:354](https://github.com/TanStack/query/blob/main/packages/vue-query/src/useQueries.ts#L354) @@ -43,7 +48,12 @@ previously rendered queries, because the number of queries can differ between re ### options -`ShallowOption` & `object` +`ShallowOption` & \{ + `combine?`: (`result`: [`UseQueriesResults`](../type-aliases/UseQueriesResults.md)\<`T`\>) => `TCombinedResult`; + `queries`: \| (() => `MaybeRefDeep`\<`UseQueriesOptionsArg`\<`T`\>\>) + \| `MaybeRefDeep`\<`UseQueriesOptionsArg`\<`T`\>\> + \| `MaybeRefDeep`\ }`\]\>; +\} The `queries` array to run, and the optional `combine` and `shallow` options. diff --git a/docs/framework/vue/reference/interfaces/DefaultOptions.md b/docs/framework/vue/reference/interfaces/DefaultOptions.md index 84575bbe879..60dee8061c1 100644 --- a/docs/framework/vue/reference/interfaces/DefaultOptions.md +++ b/docs/framework/vue/reference/interfaces/DefaultOptions.md @@ -21,7 +21,7 @@ The default options of a `QueryClient`, applied to every query (`queries`), muta | Property | Type | Description | | ------ | ------ | ------ | | `dehydrate?` | [`DehydrateOptions`](DehydrateOptions.md) | Default options used when dehydrating the client's caches; see [DehydrateOptions](DehydrateOptions.md). | -| `hydrate?` | `object` | Default options used when hydrating queries and mutations; see [HydrateOptions](HydrateOptions.md). | +| `hydrate?` | \{ `deserializeData?`: `TransformerFn`; `mutations?`: `MutationOptions`\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: `QueryOptions`\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \} | Default options used when hydrating queries and mutations; see [HydrateOptions](HydrateOptions.md). | | `hydrate.deserializeData?` | `TransformerFn` | Transforms a query's `data` after it is read from the dehydrated state, reversing `serializeData`. | | `hydrate.mutations?` | `MutationOptions`\<`unknown`, `Error`, `unknown`, `unknown`\> | Default options merged into every mutation restored from the dehydrated state. | | `hydrate.queries?` | `QueryOptions`\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\> | Default options merged into every query restored from the dehydrated state. | diff --git a/docs/framework/vue/reference/interfaces/EnsureQueryDataOptions.md b/docs/framework/vue/reference/interfaces/EnsureQueryDataOptions.md index 489415d5d37..c53cef82839 100644 --- a/docs/framework/vue/reference/interfaces/EnsureQueryDataOptions.md +++ b/docs/framework/vue/reference/interfaces/EnsureQueryDataOptions.md @@ -46,10 +46,10 @@ Defined in: [packages/query-core/src/types.ts:774](https://github.com/TanStack/q | ~~`maxPages?`~~ | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | ~~`meta?`~~ | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | ~~`networkMode?`~~ | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: `QueryClient`; `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | ~~`queryFn?`~~ | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | ~~`queryHash?`~~ | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| ~~`queryKey`~~ | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| ~~`queryKey`~~ | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | ~~`queryKeyHashFn?`~~ | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | ~~`retry?`~~ | \| `number` \| `false` \| `true` \| ((`failureCount`: `number`, `error`: `TError`) => `boolean`) | `undefined` | If `false`, failed queries will not retry by default. If `true`, failed queries will retry infinitely. If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number. If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false. Defaults to `3` on the client and `0` on the server. | | ~~`retryDelay?`~~ | `number` \| ((`failureCount`: `number`, `error`: `TError`) => `number`) | `undefined` | This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. A function like `attempt => attempt * 1000` applies linear backoff. Defaults to a function that applies exponential backoff, capped at 30 seconds. | diff --git a/docs/framework/vue/reference/interfaces/FetchQueryOptions.md b/docs/framework/vue/reference/interfaces/FetchQueryOptions.md index c02ad9e6a64..8a1e203283d 100644 --- a/docs/framework/vue/reference/interfaces/FetchQueryOptions.md +++ b/docs/framework/vue/reference/interfaces/FetchQueryOptions.md @@ -50,10 +50,10 @@ Defined in: [packages/query-core/src/types.ts:752](https://github.com/TanStack/q | ~~`maxPages?`~~ | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | ~~`meta?`~~ | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | ~~`networkMode?`~~ | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| ~~`persister?`~~ | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: `QueryClient`; `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | ~~`queryFn?`~~ | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | ~~`queryHash?`~~ | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| ~~`queryKey`~~ | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| ~~`queryKey`~~ | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | ~~`queryKeyHashFn?`~~ | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | ~~`retry?`~~ | \| `number` \| `false` \| `true` \| ((`failureCount`: `number`, `error`: `TError`) => `boolean`) | `undefined` | If `false`, failed queries will not retry by default. If `true`, failed queries will retry infinitely. If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number. If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false. Defaults to `3` on the client and `0` on the server. | | ~~`retryDelay?`~~ | `number` \| ((`failureCount`: `number`, `error`: `TError`) => `number`) | `undefined` | This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. A function like `attempt => attempt * 1000` applies linear backoff. Defaults to a function that applies exponential backoff, capped at 30 seconds. | diff --git a/docs/framework/vue/reference/interfaces/HydrateOptions.md b/docs/framework/vue/reference/interfaces/HydrateOptions.md index 5f682d10549..8415521afc3 100644 --- a/docs/framework/vue/reference/interfaces/HydrateOptions.md +++ b/docs/framework/vue/reference/interfaces/HydrateOptions.md @@ -14,7 +14,7 @@ Options for `hydrate`, controlling the default options applied to queries/mutati | Property | Type | Description | | ------ | ------ | ------ | -| `defaultOptions?` | `object` | Options applied to the queries and mutations restored from the dehydrated state. | +| `defaultOptions?` | \{ `deserializeData?`: `TransformerFn`; `mutations?`: `MutationOptions`\<`unknown`, `Error`, `unknown`, `unknown`\>; `queries?`: `QueryOptions`\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\>; \} | Options applied to the queries and mutations restored from the dehydrated state. | | `defaultOptions.deserializeData?` | `TransformerFn` | Transforms a query's `data` after it is read from the dehydrated state, reversing `serializeData`. | | `defaultOptions.mutations?` | `MutationOptions`\<`unknown`, `Error`, `unknown`, `unknown`\> | Default options merged into every mutation restored from the dehydrated state. | | `defaultOptions.queries?` | `QueryOptions`\<`unknown`, `Error`, `unknown`, readonly `unknown`[], `never`\> | Default options merged into every query restored from the dehydrated state. | diff --git a/docs/framework/vue/reference/interfaces/InfiniteQueryObserverOptions.md b/docs/framework/vue/reference/interfaces/InfiniteQueryObserverOptions.md index 418e3d41ebf..d03bef59c09 100644 --- a/docs/framework/vue/reference/interfaces/InfiniteQueryObserverOptions.md +++ b/docs/framework/vue/reference/interfaces/InfiniteQueryObserverOptions.md @@ -52,11 +52,11 @@ The options of an `InfiniteQueryObserver`: [QueryObserverOptions](QueryObserverO | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: `QueryClient`; `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| ((`previousData`: \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<[`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TError`, [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\> \| `undefined`) => \| [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, [`InfiniteData`](InfiniteData.md)\<`TQueryFnData`, `TPageParam`\>, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/vue/reference/interfaces/QueryExecuteOptions.md b/docs/framework/vue/reference/interfaces/QueryExecuteOptions.md index a449fdb5603..60bb448cfd1 100644 --- a/docs/framework/vue/reference/interfaces/QueryExecuteOptions.md +++ b/docs/framework/vue/reference/interfaces/QueryExecuteOptions.md @@ -52,10 +52,10 @@ transforms the value the call resolves with. | `maxPages?` | `number` | `undefined` | Maximum number of pages to store in the data of an infinite query. | | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: `QueryClient`; `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `retry?` | \| `number` \| `false` \| `true` \| ((`failureCount`: `number`, `error`: `TError`) => `boolean`) | `undefined` | If `false`, failed queries will not retry by default. If `true`, failed queries will retry infinitely. If set to an integer number, e.g. 3, failed queries will retry until the failed query count meets that number. If set to a function `(failureCount, error) => boolean` failed queries will retry until the function returns false. Defaults to `3` on the client and `0` on the server. | | `retryDelay?` | `number` \| ((`failureCount`: `number`, `error`: `TError`) => `number`) | `undefined` | This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. A function like `attempt => attempt * 1000` applies linear backoff. Defaults to a function that applies exponential backoff, capped at 30 seconds. | diff --git a/docs/framework/vue/reference/interfaces/QueryObserverOptions.md b/docs/framework/vue/reference/interfaces/QueryObserverOptions.md index f3874837ea2..e310129992d 100644 --- a/docs/framework/vue/reference/interfaces/QueryObserverOptions.md +++ b/docs/framework/vue/reference/interfaces/QueryObserverOptions.md @@ -57,11 +57,11 @@ The options of a `QueryObserver`, and of the hooks built on it like `useQuery`: | `meta?` | `Record`\<`string`, `unknown`\> | `undefined` | Additional payload to be stored on each query. Use this property to pass information that can be used in other places. | | `networkMode?` | `"online"` \| `"always"` \| `"offlineFirst"` | `'online'` | Controls whether a query is allowed to run based on the current network connectivity. **See** [Network Mode](https://tanstack.com/query/latest/docs/framework/react/guides/network-mode) for more information. | | `notifyOnChangeProps?` | \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `"all"` \| (() => \| `"all"` \| ( \| `"error"` \| `"data"` \| `"isError"` \| `"isPending"` \| `"isLoading"` \| `"isLoadingError"` \| `"isRefetchError"` \| `"isSuccess"` \| `"isPlaceholderData"` \| `"status"` \| `"dataUpdatedAt"` \| `"errorUpdatedAt"` \| `"failureCount"` \| `"failureReason"` \| `"errorUpdateCount"` \| `"isFetched"` \| `"isFetchedAfterMount"` \| `"isFetching"` \| `"isInitialLoading"` \| `"isPaused"` \| `"isRefetching"` \| `"isStale"` \| `"isEnabled"` \| `"refetch"` \| `"fetchStatus"` \| `"fetchNextPage"` \| `"fetchPreviousPage"` \| `"hasNextPage"` \| `"hasPreviousPage"` \| `"isFetchNextPageError"` \| `"isFetchingNextPage"` \| `"isFetchPreviousPageError"` \| `"isFetchingPreviousPage"`)[] \| `undefined`) | `undefined` | If set, the component will only re-render if any of the listed properties change. When set to `['data', 'error']`, the component will only re-render when the `data` or `error` properties change. When set to `'all'`, the component will re-render whenever a query is updated. When set to a function, the function will be executed to compute the list of properties. Defaults to `undefined`, in which case property access is tracked automatically, and the component only re-renders when one of the tracked properties changes. | -| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: `object`, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | +| `persister?` | (`queryFn`: (`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`NoInfer`\<`TQueryKey`\>, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>, `context`: \{ `client`: `QueryClient`; `direction?`: `unknown`; `meta`: `Record`\<`string`, `unknown`\> \| `undefined`; `pageParam?`: `unknown`; `queryKey`: `NoInfer`\<`TQueryKey`\>; `signal`: `AbortSignal`; \}, `query`: [`Query`](../classes/Query.md)) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\> | `undefined` | This option can be used to persist the result of a query to an external storage, bypassing the need to actually call the `queryFn`. Useful for persisting a query's data across e.g. server/client boundaries. | | `placeholderData?` | \| `NonFunctionGuard`\<`TQueryData`\> \| ((`previousData`: `NonFunctionGuard`\<`TQueryData`\> \| `undefined`, `previousQuery`: \| [`Query`](../classes/Query.md)\<`NonFunctionGuard`\<`TQueryData`\>, `TError`, `NonFunctionGuard`\<`TQueryData`\>, `TQueryKey`\> \| `undefined`) => `NonFunctionGuard`\<`TQueryData`\> \| `undefined`) | `undefined` | If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `loading` data and no initialData has been provided. | | `queryFn?` | \| *typeof* [`skipToken`](../variables/skipToken.md) \| ((`context`: [`QueryFunctionContext`](../type-aliases/QueryFunctionContext.md)\<`TQueryKey`, `TPageParam`\>) => `TQueryFnData` \| `Promise`\<`TQueryFnData`\>) | `undefined` | The function that the query will use to request data. Required, unless a default query function has been set via `queryClient.setQueryDefaults` or `queryClient.setDefaultOptions`. Receives a [QueryFunctionContext](../type-aliases/QueryFunctionContext.md). Must return a promise that will either resolve data or throw an error. The data cannot be `undefined`. | | `queryHash?` | `string` | `undefined` | The hashed form of `queryKey`, computed with `queryKeyHashFn` (or the default hashing function otherwise). Used as the actual cache key internally. | -| `queryKey` | `TQueryKey` & `object` | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | +| `queryKey` | `TQueryKey` & \{ \} | `undefined` | The query key to use for this query. The query key will be hashed into a stable hash. See [Query Keys](https://tanstack.com/query/latest/docs/framework/react/guides/query-keys) for more information. The query will automatically update when this key changes (as long as `enabled` is not set to `false`). | | `queryKeyHashFn?` | (`queryKey`: `TQueryKey`) => `string` | `undefined` | If specified, this function is used to hash the `queryKey` to a string. | | `refetchInterval?` | \| `number` \| `false` \| ((`query`: [`Query`](../classes/Query.md)\<`TQueryFnData`, `TError`, `TQueryData`, `TQueryKey`\>) => `number` \| `false` \| `undefined`) | `false` | If set to a number, the query will continuously refetch at this frequency in milliseconds. If set to a function, the function will be executed with the latest data and query to compute a frequency | | `refetchIntervalInBackground?` | `boolean` | `false` | If set to `true`, the query will continue to refetch while their tab/window is in the background. | diff --git a/docs/framework/vue/reference/type-aliases/AnyDataTag.md b/docs/framework/vue/reference/type-aliases/AnyDataTag.md index 4b9304ed2ee..65d582ac8aa 100644 --- a/docs/framework/vue/reference/type-aliases/AnyDataTag.md +++ b/docs/framework/vue/reference/type-aliases/AnyDataTag.md @@ -6,7 +6,10 @@ title: AnyDataTag ```ts -type AnyDataTag = object; +type AnyDataTag = { + [dataTagErrorSymbol]: any; + [dataTagSymbol]: any; +}; ``` Defined in: [packages/query-core/src/types.ts:122](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L122) diff --git a/docs/framework/vue/reference/type-aliases/DataTag.md b/docs/framework/vue/reference/type-aliases/DataTag.md index 6e5cbfd46b9..22389c45a62 100644 --- a/docs/framework/vue/reference/type-aliases/DataTag.md +++ b/docs/framework/vue/reference/type-aliases/DataTag.md @@ -6,7 +6,10 @@ title: DataTag ```ts -type DataTag = TType extends AnyDataTag ? TType : TType & object; +type DataTag = TType extends AnyDataTag ? TType : TType & { + [dataTagErrorSymbol]: TError; + [dataTagSymbol]: TValue; +}; ``` Defined in: [packages/query-core/src/types.ts:137](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L137) diff --git a/docs/framework/vue/reference/type-aliases/DefaultError.md b/docs/framework/vue/reference/type-aliases/DefaultError.md index 85150115168..1db2fd40ed7 100644 --- a/docs/framework/vue/reference/type-aliases/DefaultError.md +++ b/docs/framework/vue/reference/type-aliases/DefaultError.md @@ -6,7 +6,9 @@ title: DefaultError ```ts -type DefaultError = Register extends object ? TError : Error; +type DefaultError = Register extends { + defaultError: infer TError; +} ? TError : Error; ``` Defined in: [packages/query-core/src/types.ts:83](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L83) diff --git a/docs/framework/vue/reference/type-aliases/DefinedInitialDataInfiniteOptions.md b/docs/framework/vue/reference/type-aliases/DefinedInitialDataInfiniteOptions.md index 2a8fab41430..c539a0142e8 100644 --- a/docs/framework/vue/reference/type-aliases/DefinedInitialDataInfiniteOptions.md +++ b/docs/framework/vue/reference/type-aliases/DefinedInitialDataInfiniteOptions.md @@ -6,7 +6,10 @@ title: DefinedInitialDataInfiniteOptions ```ts -type DefinedInitialDataInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions & object; +type DefinedInitialDataInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions & { + initialData: | NonUndefinedGuard> + | (() => NonUndefinedGuard>); +}; ``` Defined in: [packages/vue-query/src/infiniteQueryOptions.ts:46](https://github.com/TanStack/query/blob/main/packages/vue-query/src/infiniteQueryOptions.ts#L46) diff --git a/docs/framework/vue/reference/type-aliases/EnsureInfiniteQueryDataOptions.md b/docs/framework/vue/reference/type-aliases/EnsureInfiniteQueryDataOptions.md index 1142c9bf005..d9c876a6029 100644 --- a/docs/framework/vue/reference/type-aliases/EnsureInfiniteQueryDataOptions.md +++ b/docs/framework/vue/reference/type-aliases/EnsureInfiniteQueryDataOptions.md @@ -6,7 +6,9 @@ title: EnsureInfiniteQueryDataOptions ```ts -type EnsureInfiniteQueryDataOptions = FetchInfiniteQueryOptions & object; +type EnsureInfiniteQueryDataOptions = FetchInfiniteQueryOptions & { + revalidateIfStale?: boolean; +}; ``` Defined in: [packages/query-core/src/types.ts:794](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L794) diff --git a/docs/framework/vue/reference/type-aliases/MutationFunctionContext.md b/docs/framework/vue/reference/type-aliases/MutationFunctionContext.md index cc52d82ee47..ec371ef8d09 100644 --- a/docs/framework/vue/reference/type-aliases/MutationFunctionContext.md +++ b/docs/framework/vue/reference/type-aliases/MutationFunctionContext.md @@ -6,7 +6,11 @@ title: MutationFunctionContext ```ts -type MutationFunctionContext = object; +type MutationFunctionContext = { + client: QueryClient; + meta: MutationMeta | undefined; + mutationKey?: MutationKey; +}; ``` Defined in: [packages/query-core/src/types.ts:1855](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1855) diff --git a/docs/framework/vue/reference/type-aliases/MutationKey.md b/docs/framework/vue/reference/type-aliases/MutationKey.md index 7c598833c16..372431c32fb 100644 --- a/docs/framework/vue/reference/type-aliases/MutationKey.md +++ b/docs/framework/vue/reference/type-aliases/MutationKey.md @@ -6,7 +6,9 @@ title: MutationKey ```ts -type MutationKey = Register extends object ? TMutationKey extends ReadonlyArray ? TMutationKey : TMutationKey extends unknown[] ? TMutationKey : ReadonlyArray : ReadonlyArray; +type MutationKey = Register extends { + mutationKey: infer TMutationKey; +} ? TMutationKey extends ReadonlyArray ? TMutationKey : TMutationKey extends unknown[] ? TMutationKey : ReadonlyArray : ReadonlyArray; ``` Defined in: [packages/query-core/src/types.ts:1814](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1814) diff --git a/docs/framework/vue/reference/type-aliases/MutationMeta.md b/docs/framework/vue/reference/type-aliases/MutationMeta.md index 2b7dc7446ae..ddac47dcfc4 100644 --- a/docs/framework/vue/reference/type-aliases/MutationMeta.md +++ b/docs/framework/vue/reference/type-aliases/MutationMeta.md @@ -6,7 +6,9 @@ title: MutationMeta ```ts -type MutationMeta = Register extends object ? TMutationMeta extends Record ? TMutationMeta : Record : Record; +type MutationMeta = Register extends { + mutationMeta: infer TMutationMeta; +} ? TMutationMeta extends Record ? TMutationMeta : Record : Record; ``` Defined in: [packages/query-core/src/types.ts:1843](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1843) diff --git a/docs/framework/vue/reference/type-aliases/MutationScope.md b/docs/framework/vue/reference/type-aliases/MutationScope.md index 4357b2d629d..f859dc913a9 100644 --- a/docs/framework/vue/reference/type-aliases/MutationScope.md +++ b/docs/framework/vue/reference/type-aliases/MutationScope.md @@ -6,7 +6,9 @@ title: MutationScope ```ts -type MutationScope = object; +type MutationScope = { + id: string; +}; ``` Defined in: [packages/query-core/src/types.ts:1832](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L1832) diff --git a/docs/framework/vue/reference/type-aliases/MutationStateOptions.md b/docs/framework/vue/reference/type-aliases/MutationStateOptions.md index 726bbc65d12..f194e82332a 100644 --- a/docs/framework/vue/reference/type-aliases/MutationStateOptions.md +++ b/docs/framework/vue/reference/type-aliases/MutationStateOptions.md @@ -6,7 +6,10 @@ title: MutationStateOptions ```ts -type MutationStateOptions = MutationTypeFromResult> = object; +type MutationStateOptions = MutationTypeFromResult> = { + filters?: VueMutationFilters; + select?: (mutation: TMutation) => TResult; +}; ``` Defined in: [packages/vue-query/src/useMutationState.ts:98](https://github.com/TanStack/query/blob/main/packages/vue-query/src/useMutationState.ts#L98) diff --git a/docs/framework/vue/reference/type-aliases/QueryFunctionContext.md b/docs/framework/vue/reference/type-aliases/QueryFunctionContext.md index 15a8d2e9261..59324fb3aeb 100644 --- a/docs/framework/vue/reference/type-aliases/QueryFunctionContext.md +++ b/docs/framework/vue/reference/type-aliases/QueryFunctionContext.md @@ -6,7 +6,21 @@ title: QueryFunctionContext ```ts -type QueryFunctionContext = [TPageParam] extends [never] ? object : object; +type QueryFunctionContext = [TPageParam] extends [never] ? { + client: QueryClient; + direction?: unknown; + meta: QueryMeta | undefined; + pageParam?: unknown; + queryKey: TQueryKey; + signal: AbortSignal; +} : { + client: QueryClient; + direction: FetchDirection; + meta: QueryMeta | undefined; + pageParam: TPageParam; + queryKey: TQueryKey; + signal: AbortSignal; +}; ``` Defined in: [packages/query-core/src/types.ts:235](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L235) diff --git a/docs/framework/vue/reference/type-aliases/QueryKey.md b/docs/framework/vue/reference/type-aliases/QueryKey.md index 6a2c8ca5503..d358486f29b 100644 --- a/docs/framework/vue/reference/type-aliases/QueryKey.md +++ b/docs/framework/vue/reference/type-aliases/QueryKey.md @@ -6,7 +6,9 @@ title: QueryKey ```ts -type QueryKey = Register extends object ? TQueryKey extends ReadonlyArray ? TQueryKey : TQueryKey extends unknown[] ? TQueryKey : ReadonlyArray : ReadonlyArray; +type QueryKey = Register extends { + queryKey: infer TQueryKey; +} ? TQueryKey extends ReadonlyArray ? TQueryKey : TQueryKey extends unknown[] ? TQueryKey : ReadonlyArray : ReadonlyArray; ``` Defined in: [packages/query-core/src/types.ts:93](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L93) diff --git a/docs/framework/vue/reference/type-aliases/QueryKeyWithDataTag.md b/docs/framework/vue/reference/type-aliases/QueryKeyWithDataTag.md index 60244136ec1..f4c0ab86c9a 100644 --- a/docs/framework/vue/reference/type-aliases/QueryKeyWithDataTag.md +++ b/docs/framework/vue/reference/type-aliases/QueryKeyWithDataTag.md @@ -6,7 +6,9 @@ title: QueryKeyWithDataTag ```ts -type QueryKeyWithDataTag = object; +type QueryKeyWithDataTag = { + queryKey: DataTag; +}; ``` Defined in: [packages/query-core/src/types.ts:152](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L152) diff --git a/docs/framework/vue/reference/type-aliases/QueryMeta.md b/docs/framework/vue/reference/type-aliases/QueryMeta.md index 3df2e5a17bd..6f1b27a3d9e 100644 --- a/docs/framework/vue/reference/type-aliases/QueryMeta.md +++ b/docs/framework/vue/reference/type-aliases/QueryMeta.md @@ -6,7 +6,9 @@ title: QueryMeta ```ts -type QueryMeta = Register extends object ? TQueryMeta extends Record ? TQueryMeta : Record : Record; +type QueryMeta = Register extends { + queryMeta: infer TQueryMeta; +} ? TQueryMeta extends Record ? TQueryMeta : Record : Record; ``` Defined in: [packages/query-core/src/types.ts:330](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L330) diff --git a/docs/framework/vue/reference/type-aliases/TimeoutProvider.md b/docs/framework/vue/reference/type-aliases/TimeoutProvider.md index 6e3fd194540..88cd72aa7e3 100644 --- a/docs/framework/vue/reference/type-aliases/TimeoutProvider.md +++ b/docs/framework/vue/reference/type-aliases/TimeoutProvider.md @@ -6,7 +6,12 @@ title: TimeoutProvider ```ts -type TimeoutProvider = object; +type TimeoutProvider = { + clearInterval: (intervalId: TTimerId | undefined) => void; + clearTimeout: (timeoutId: TTimerId | undefined) => void; + setInterval: (callback: TimeoutCallback, delay: number) => TTimerId; + setTimeout: (callback: TimeoutCallback, delay: number) => TTimerId; +}; ``` Defined in: [packages/query-core/src/timeoutManager.ts:28](https://github.com/TanStack/query/blob/main/packages/query-core/src/timeoutManager.ts#L28) diff --git a/docs/framework/vue/reference/type-aliases/UndefinedInitialDataInfiniteOptions.md b/docs/framework/vue/reference/type-aliases/UndefinedInitialDataInfiniteOptions.md index 15f7385f24c..51a991d3a7d 100644 --- a/docs/framework/vue/reference/type-aliases/UndefinedInitialDataInfiniteOptions.md +++ b/docs/framework/vue/reference/type-aliases/UndefinedInitialDataInfiniteOptions.md @@ -6,7 +6,9 @@ title: UndefinedInitialDataInfiniteOptions ```ts -type UndefinedInitialDataInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions & object; +type UndefinedInitialDataInfiniteOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions & { + initialData?: undefined; +}; ``` Defined in: [packages/vue-query/src/infiniteQueryOptions.ts:20](https://github.com/TanStack/query/blob/main/packages/vue-query/src/infiniteQueryOptions.ts#L20) diff --git a/docs/framework/vue/reference/type-aliases/UseMutationReturnType.md b/docs/framework/vue/reference/type-aliases/UseMutationReturnType.md index cc0794b75f4..1dea5cc1d80 100644 --- a/docs/framework/vue/reference/type-aliases/UseMutationReturnType.md +++ b/docs/framework/vue/reference/type-aliases/UseMutationReturnType.md @@ -6,7 +6,11 @@ title: UseMutationReturnType ```ts -type UseMutationReturnType> = ToRefs> & object; +type UseMutationReturnType> = ToRefs> & { + mutate: MutateSyncFunction; + mutateAsync: MutateFunction; + reset: MutationObserverResult["reset"]; +}; ``` Defined in: [packages/vue-query/src/useMutation.ts:65](https://github.com/TanStack/query/blob/main/packages/vue-query/src/useMutation.ts#L65) diff --git a/docs/framework/vue/reference/type-aliases/UsePrefetchInfiniteQueryOptions.md b/docs/framework/vue/reference/type-aliases/UsePrefetchInfiniteQueryOptions.md index c6c988b52c5..efb359d69e0 100644 --- a/docs/framework/vue/reference/type-aliases/UsePrefetchInfiniteQueryOptions.md +++ b/docs/framework/vue/reference/type-aliases/UsePrefetchInfiniteQueryOptions.md @@ -6,7 +6,9 @@ title: UsePrefetchInfiniteQueryOptions ```ts -type UsePrefetchInfiniteQueryOptions = DistributiveOmit, "queryFn"> & object; +type UsePrefetchInfiniteQueryOptions = DistributiveOmit, "queryFn"> & { + queryFn?: Exclude["queryFn"], SkipToken>; +}; ``` Defined in: [packages/vue-query/src/usePrefetchInfiniteQuery.ts:20](https://github.com/TanStack/query/blob/main/packages/vue-query/src/usePrefetchInfiniteQuery.ts#L20) diff --git a/docs/framework/vue/reference/type-aliases/UsePrefetchQueryOptions.md b/docs/framework/vue/reference/type-aliases/UsePrefetchQueryOptions.md index d346fed80a8..5c86f718c97 100644 --- a/docs/framework/vue/reference/type-aliases/UsePrefetchQueryOptions.md +++ b/docs/framework/vue/reference/type-aliases/UsePrefetchQueryOptions.md @@ -6,7 +6,9 @@ title: UsePrefetchQueryOptions ```ts -type UsePrefetchQueryOptions = OmitKeyof, "queryFn"> & object; +type UsePrefetchQueryOptions = OmitKeyof, "queryFn"> & { + queryFn?: Exclude["queryFn"], SkipToken>; +}; ``` Defined in: [packages/vue-query/src/usePrefetchQuery.ts:19](https://github.com/TanStack/query/blob/main/packages/vue-query/src/usePrefetchQuery.ts#L19) diff --git a/docs/framework/vue/reference/variables/VueQueryPlugin.md b/docs/framework/vue/reference/variables/VueQueryPlugin.md index 521c03f76d8..37ead1d9a42 100644 --- a/docs/framework/vue/reference/variables/VueQueryPlugin.md +++ b/docs/framework/vue/reference/variables/VueQueryPlugin.md @@ -6,7 +6,9 @@ title: VueQueryPlugin ```ts -const VueQueryPlugin: object; +const VueQueryPlugin: { + install: (app: any, options: VueQueryPluginOptions) => void; +}; ``` Defined in: [packages/vue-query/src/vueQueryPlugin.ts:75](https://github.com/TanStack/query/blob/main/packages/vue-query/src/vueQueryPlugin.ts#L75) diff --git a/docs/framework/vue/reference/variables/environmentManager.md b/docs/framework/vue/reference/variables/environmentManager.md index 40b82d3a2de..4e8224270d3 100644 --- a/docs/framework/vue/reference/variables/environmentManager.md +++ b/docs/framework/vue/reference/variables/environmentManager.md @@ -6,7 +6,10 @@ title: environmentManager ```ts -const environmentManager: object; +const environmentManager: { + isServer: () => boolean; + setIsServer(isServerValue: IsServerValue): void; +}; ``` Defined in: [packages/query-core/src/environmentManager.ts:32](https://github.com/TanStack/query/blob/main/packages/query-core/src/environmentManager.ts#L32) diff --git a/docs/framework/vue/reference/variables/notifyManager.md b/docs/framework/vue/reference/variables/notifyManager.md index 82290f7f19a..5ddda37894d 100644 --- a/docs/framework/vue/reference/variables/notifyManager.md +++ b/docs/framework/vue/reference/variables/notifyManager.md @@ -6,7 +6,14 @@ title: notifyManager ```ts -const notifyManager: object; +const notifyManager: { + batch: (callback: () => T) => T; + batchCalls: (callback: BatchCallsCallback) => BatchCallsCallback; + schedule: (callback: NotifyCallback) => void; + setBatchNotifyFunction: (fn: BatchNotifyFunction) => void; + setNotifyFunction: (fn: NotifyFunction) => void; + setScheduler: (fn: ScheduleFunction) => void; +}; ``` Defined in: [packages/query-core/src/notifyManager.ts:154](https://github.com/TanStack/query/blob/main/packages/query-core/src/notifyManager.ts#L154) diff --git a/scripts/generate-docs.ts b/scripts/generate-docs.ts index 1a8f92d29fa..79158a6337a 100644 --- a/scripts/generate-docs.ts +++ b/scripts/generate-docs.ts @@ -167,6 +167,7 @@ async function generatePackageReferenceDocs(pkg: PackageReferenceDocsConfig) { // Without this, a function property renders as `(data) => TData` — the table and list formats // both omit the parameter types otherwise. expandParameters: true, + expandObjects: true, excludePrivate: true, excludeProtected: true, excludeInternal: true,