From b85b0d1460680dfe2561643991ab6d81e2d10116 Mon Sep 17 00:00:00 2001 From: Wonsuk Choi Date: Fri, 4 Sep 2026 11:45:02 +0900 Subject: [PATCH] docs(preact-query): add 'The Query Options API' link, matching react's queryOptions JSDoc --- .../preact/reference/functions/queryOptions.md | 15 +++++++++------ packages/preact-query/src/queryOptions.ts | 3 +++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/framework/preact/reference/functions/queryOptions.md b/docs/framework/preact/reference/functions/queryOptions.md index d76dff8c4bc..ac200a49bfe 100644 --- a/docs/framework/preact/reference/functions/queryOptions.md +++ b/docs/framework/preact/reference/functions/queryOptions.md @@ -9,7 +9,7 @@ title: queryOptions function queryOptions(options): Omit, "queryFn"> & object & QueryKeyWithDataTag; ``` -Defined in: [preact-query/src/queryOptions.ts:142](https://github.com/TanStack/query/blob/main/packages/preact-query/src/queryOptions.ts#L142) +Defined in: [preact-query/src/queryOptions.ts:143](https://github.com/TanStack/query/blob/main/packages/preact-query/src/queryOptions.ts#L143) 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 @@ -49,7 +49,8 @@ The same options object, typed so that `queryKey` carries the inferred data type ### See -[useQuery](useQuery.md) to run a query with these options. + - [useQuery](useQuery.md) to run a query with these options. + - [The Query Options API](https://tkdodo.eu/blog/the-query-options-api) for more on this pattern. ### Example @@ -84,7 +85,7 @@ function Posts() { function queryOptions(options): OmitKeyof, "queryFn"> & object & QueryKeyWithDataTag; ``` -Defined in: [preact-query/src/queryOptions.ts:182](https://github.com/TanStack/query/blob/main/packages/preact-query/src/queryOptions.ts#L182) +Defined in: [preact-query/src/queryOptions.ts:184](https://github.com/TanStack/query/blob/main/packages/preact-query/src/queryOptions.ts#L184) 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 @@ -122,7 +123,8 @@ The same options object, typed so that `queryKey` carries the inferred data type ### See -[useQuery](useQuery.md) to run a query with these options. + - [useQuery](useQuery.md) to run a query with these options. + - [The Query Options API](https://tkdodo.eu/blog/the-query-options-api) for more on this pattern. ### Example @@ -152,7 +154,7 @@ function Post({ id }: { id: string }) { function queryOptions(options): UseQueryOptions & object & QueryKeyWithDataTag; ``` -Defined in: [preact-query/src/queryOptions.ts:245](https://github.com/TanStack/query/blob/main/packages/preact-query/src/queryOptions.ts#L245) +Defined in: [preact-query/src/queryOptions.ts:248](https://github.com/TanStack/query/blob/main/packages/preact-query/src/queryOptions.ts#L248) 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 @@ -190,7 +192,8 @@ The same options object, typed so that `queryKey` carries the inferred data type ### See -[useQuery](useQuery.md) to run a query with these options. + - [useQuery](useQuery.md) to run a query with these options. + - [The Query Options API](https://tkdodo.eu/blog/the-query-options-api) for more on this pattern. ### Remarks diff --git a/packages/preact-query/src/queryOptions.ts b/packages/preact-query/src/queryOptions.ts index 2bb826b1ec6..30084a77928 100644 --- a/packages/preact-query/src/queryOptions.ts +++ b/packages/preact-query/src/queryOptions.ts @@ -110,6 +110,7 @@ export type DefinedInitialDataOptions< * This overload is selected when `initialData` is set, so the resulting `data` is never `undefined`. * * @see {@link useQuery} to run a query with these options. + * @see [The Query Options API](https://tkdodo.eu/blog/the-query-options-api) for more on this pattern. * @param options - The {@link DefinedInitialDataOptions} to use — everything you can pass to `useQuery`, with `initialData` set. * @returns The same options object, typed so that `queryKey` carries the inferred data type. * @@ -155,6 +156,7 @@ export function queryOptions< * is the query key to generate options for. * * @see {@link useQuery} to run a query with these options. + * @see [The Query Options API](https://tkdodo.eu/blog/the-query-options-api) for more on this pattern. * @param options - The {@link UnusedSkipTokenOptions} to use — everything you can pass to `useQuery`. * @returns The same options object, typed so that `queryKey` carries the inferred data type. * @@ -195,6 +197,7 @@ export function queryOptions< * is the query key to generate options for. * * @see {@link useQuery} to run a query with these options. + * @see [The Query Options API](https://tkdodo.eu/blog/the-query-options-api) for more on this pattern. * @param options - The {@link UndefinedInitialDataOptions} to use — everything you can pass to `useQuery`. * @returns The same options object, typed so that `queryKey` carries the inferred data type. * @remarks This is the only overload that accepts `queryFn: skipToken`, shown below.