Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: HydrationBoundary
function HydrationBoundary(__namedParameters): Element;
```

Defined in: [preact-query/src/HydrationBoundary.tsx:85](https://github.com/TanStack/query/blob/main/packages/preact-query/src/HydrationBoundary.tsx#L85)
Defined in: [preact-query/src/HydrationBoundary.tsx:84](https://github.com/TanStack/query/blob/main/packages/preact-query/src/HydrationBoundary.tsx#L84)

`HydrationBoundary` adds a previously dehydrated state into the `queryClient` that would be returned by
`useQueryClient()`. If the client already contains data, the new queries will be intelligently merged based on
Expand Down Expand Up @@ -41,8 +41,7 @@ function App() {

Server-side prefetch handed off to the client via `dehydrate`:
```tsx
import { noop } from '@tanstack/query-core'
import { HydrationBoundary, dehydrate } from '@tanstack/preact-query'
import { HydrationBoundary, dehydrate, noop } from '@tanstack/preact-query'

async function ServerComponent() {
const queryClient = getQueryClient()
Expand Down
18 changes: 12 additions & 6 deletions docs/framework/preact/reference/functions/infiniteQueryOptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function Projects() {
function infiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>(options): OmitKeyof<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, "queryFn"> & object & QueryKeyWithDataTag<TQueryKey, InfiniteData<TQueryFnData, unknown>, TError>;
```

Defined in: [preact-query/src/infiniteQueryOptions.ts:194](https://github.com/TanStack/query/blob/main/packages/preact-query/src/infiniteQueryOptions.ts#L194)
Defined in: [preact-query/src/infiniteQueryOptions.ts:197](https://github.com/TanStack/query/blob/main/packages/preact-query/src/infiniteQueryOptions.ts#L197)

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`.
Expand Down Expand Up @@ -131,8 +131,11 @@ export const projectsOptions = infiniteQueryOptions({

A parameterized factory, reused across a hook and an imperative call with the same cache entry:
```tsx
import { noop } from '@tanstack/query-core'
import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/preact-query'
import {
infiniteQueryOptions,
noop,
useInfiniteQuery,
} from '@tanstack/preact-query'

export const commentsOptions = (postId: string) =>
infiniteQueryOptions({
Expand Down Expand Up @@ -162,7 +165,7 @@ queryClient.infiniteQuery(commentsOptions(postId)).catch(noop)
function infiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>(options): UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & object & QueryKeyWithDataTag<TQueryKey, InfiniteData<TQueryFnData, unknown>, TError>;
```

Defined in: [preact-query/src/infiniteQueryOptions.ts:266](https://github.com/TanStack/query/blob/main/packages/preact-query/src/infiniteQueryOptions.ts#L266)
Defined in: [preact-query/src/infiniteQueryOptions.ts:272](https://github.com/TanStack/query/blob/main/packages/preact-query/src/infiniteQueryOptions.ts#L272)

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`.
Expand Down Expand Up @@ -217,8 +220,11 @@ export const projectsOptions = infiniteQueryOptions({

A parameterized factory, reused across a hook and an imperative call with the same cache entry:
```tsx
import { noop } from '@tanstack/query-core'
import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/preact-query'
import {
infiniteQueryOptions,
noop,
useInfiniteQuery,
} from '@tanstack/preact-query'

export const commentsOptions = (postId: string) =>
infiniteQueryOptions({
Expand Down
26 changes: 16 additions & 10 deletions docs/framework/preact/reference/functions/queryOptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function Posts() {
function queryOptions<TQueryFnData, TError, TData, TQueryKey>(options): OmitKeyof<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, "queryFn"> & object & QueryKeyWithDataTag<TQueryKey, TQueryFnData, TError>;
```

Defined in: [preact-query/src/queryOptions.ts:169](https://github.com/TanStack/query/blob/main/packages/preact-query/src/queryOptions.ts#L169)
Defined in: [preact-query/src/queryOptions.ts:172](https://github.com/TanStack/query/blob/main/packages/preact-query/src/queryOptions.ts#L172)

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
Expand Down Expand Up @@ -120,8 +120,7 @@ export const postsOptions = queryOptions({

A parameterized factory, reused across a hook and an imperative call with the same cache entry:
```tsx
import { noop } from '@tanstack/query-core'
import { queryOptions, useQuery } from '@tanstack/preact-query'
import { noop, queryOptions, useQuery } from '@tanstack/preact-query'

export const postOptions = (id: string) =>
queryOptions({
Expand All @@ -140,8 +139,12 @@ queryClient.query(postOptions(id)).catch(noop)

The same options object works with every API that accepts query options:
```tsx
import { noop } from '@tanstack/query-core'
import { queryOptions, useQuery, useSuspenseQuery } from '@tanstack/preact-query'
import {
noop,
queryOptions,
useQuery,
useSuspenseQuery,
} from '@tanstack/preact-query'

const todosOptions = queryOptions({
queryKey: ['todos'],
Expand All @@ -160,7 +163,7 @@ queryClient.getQueryData(todosOptions.queryKey) // typed as Array<Todo> | undefi
function queryOptions<TQueryFnData, TError, TData, TQueryKey>(options): UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & object & QueryKeyWithDataTag<TQueryKey, TQueryFnData, TError>;
```

Defined in: [preact-query/src/queryOptions.ts:235](https://github.com/TanStack/query/blob/main/packages/preact-query/src/queryOptions.ts#L235)
Defined in: [preact-query/src/queryOptions.ts:241](https://github.com/TanStack/query/blob/main/packages/preact-query/src/queryOptions.ts#L241)

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
Expand Down Expand Up @@ -209,8 +212,7 @@ export const postsOptions = queryOptions({

A parameterized factory, reused across a hook and an imperative call with the same cache entry:
```tsx
import { noop } from '@tanstack/query-core'
import { queryOptions, useQuery } from '@tanstack/preact-query'
import { noop, queryOptions, useQuery } from '@tanstack/preact-query'

export const postOptions = (id: string) =>
queryOptions({
Expand All @@ -229,8 +231,12 @@ queryClient.query(postOptions(id)).catch(noop)

The same options object works with every API that accepts query options:
```tsx
import { noop } from '@tanstack/query-core'
import { queryOptions, useQuery, useSuspenseQuery } from '@tanstack/preact-query'
import {
noop,
queryOptions,
useQuery,
useSuspenseQuery,
} from '@tanstack/preact-query'

const todosOptions = queryOptions({
queryKey: ['todos'],
Expand Down
3 changes: 1 addition & 2 deletions packages/preact-query/src/HydrationBoundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ export interface HydrationBoundaryProps {
* @example
* Server-side prefetch handed off to the client via `dehydrate`:
* ```tsx
* import { noop } from '@tanstack/query-core'
* import { HydrationBoundary, dehydrate } from '@tanstack/preact-query'
* import { HydrationBoundary, dehydrate, noop } from '@tanstack/preact-query'
*
* async function ServerComponent() {
* const queryClient = getQueryClient()
Expand Down
14 changes: 10 additions & 4 deletions packages/preact-query/src/infiniteQueryOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,11 @@ export function infiniteQueryOptions<
* @example
* A parameterized factory, reused across a hook and an imperative call with the same cache entry:
* ```tsx
* import { noop } from '@tanstack/query-core'
* import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/preact-query'
* import {
* infiniteQueryOptions,
* noop,
* useInfiniteQuery,
* } from '@tanstack/preact-query'
*
* export const commentsOptions = (postId: string) =>
* infiniteQueryOptions({
Expand Down Expand Up @@ -236,8 +239,11 @@ export function infiniteQueryOptions<
* @example
* A parameterized factory, reused across a hook and an imperative call with the same cache entry:
* ```tsx
* import { noop } from '@tanstack/query-core'
* import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/preact-query'
* import {
* infiniteQueryOptions,
* noop,
* useInfiniteQuery,
* } from '@tanstack/preact-query'
*
* export const commentsOptions = (postId: string) =>
* infiniteQueryOptions({
Expand Down
22 changes: 14 additions & 8 deletions packages/preact-query/src/queryOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ export function queryOptions<
* @example
* A parameterized factory, reused across a hook and an imperative call with the same cache entry:
* ```tsx
* import { noop } from '@tanstack/query-core'
* import { queryOptions, useQuery } from '@tanstack/preact-query'
* import { noop, queryOptions, useQuery } from '@tanstack/preact-query'
*
* export const postOptions = (id: string) =>
* queryOptions({
Expand All @@ -152,8 +151,12 @@ export function queryOptions<
* @example
* The same options object works with every API that accepts query options:
* ```tsx
* import { noop } from '@tanstack/query-core'
* import { queryOptions, useQuery, useSuspenseQuery } from '@tanstack/preact-query'
* import {
* noop,
* queryOptions,
* useQuery,
* useSuspenseQuery,
* } from '@tanstack/preact-query'
*
* const todosOptions = queryOptions({
* queryKey: ['todos'],
Expand Down Expand Up @@ -197,8 +200,7 @@ export function queryOptions<
* @example
* A parameterized factory, reused across a hook and an imperative call with the same cache entry:
* ```tsx
* import { noop } from '@tanstack/query-core'
* import { queryOptions, useQuery } from '@tanstack/preact-query'
* import { noop, queryOptions, useQuery } from '@tanstack/preact-query'
*
* export const postOptions = (id: string) =>
* queryOptions({
Expand All @@ -218,8 +220,12 @@ export function queryOptions<
* @example
* The same options object works with every API that accepts query options:
* ```tsx
* import { noop } from '@tanstack/query-core'
* import { queryOptions, useQuery, useSuspenseQuery } from '@tanstack/preact-query'
* import {
* noop,
* queryOptions,
* useQuery,
* useSuspenseQuery,
* } from '@tanstack/preact-query'
*
* const todosOptions = queryOptions({
* queryKey: ['todos'],
Expand Down
Loading