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 @@ -11,7 +11,7 @@ title: useLiveInfiniteQuery
function useLiveInfiniteQuery<TResult, TKey, TUtils>(liveQueryCollection, config): UseLiveInfiniteQueryReturn<any>;
```

Defined in: [useLiveInfiniteQuery.ts:118](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveInfiniteQuery.ts#L118)
Defined in: [useLiveInfiniteQuery.ts:139](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveInfiniteQuery.ts#L139)

Create an infinite query using a query function with live updates

Expand Down Expand Up @@ -118,7 +118,7 @@ function useLiveInfiniteQuery<TContext>(
deps?): UseLiveInfiniteQueryReturn<TContext>;
```

Defined in: [useLiveInfiniteQuery.ts:128](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveInfiniteQuery.ts#L128)
Defined in: [useLiveInfiniteQuery.ts:149](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveInfiniteQuery.ts#L149)

Create an infinite query using a query function with live updates

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: UseLiveInfiniteQueryConfig
type UseLiveInfiniteQueryConfig<TContext> = object;
```

Defined in: [useLiveInfiniteQuery.ts:23](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveInfiniteQuery.ts#L23)
Defined in: [useLiveInfiniteQuery.ts:39](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveInfiniteQuery.ts#L39)

## Type Parameters

Expand All @@ -25,7 +25,7 @@ Defined in: [useLiveInfiniteQuery.ts:23](https://github.com/TanStack/db/blob/mai
optional getNextPageParam: (lastPage, allPages, lastPageParam, allPageParams) => number | undefined;
```

Defined in: [useLiveInfiniteQuery.ts:31](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveInfiniteQuery.ts#L31)
Defined in: [useLiveInfiniteQuery.ts:47](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveInfiniteQuery.ts#L47)

#### Parameters

Expand Down Expand Up @@ -63,7 +63,7 @@ Provided for API compatibility with TanStack Query conventions.
optional initialPageParam: number;
```

Defined in: [useLiveInfiniteQuery.ts:25](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveInfiniteQuery.ts#L25)
Defined in: [useLiveInfiniteQuery.ts:41](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveInfiniteQuery.ts#L41)

***

Expand All @@ -73,4 +73,4 @@ Defined in: [useLiveInfiniteQuery.ts:25](https://github.com/TanStack/db/blob/mai
optional pageSize: number;
```

Defined in: [useLiveInfiniteQuery.ts:24](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveInfiniteQuery.ts#L24)
Defined in: [useLiveInfiniteQuery.ts:40](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveInfiniteQuery.ts#L40)
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: UseLiveInfiniteQueryReturn
type UseLiveInfiniteQueryReturn<TContext> = Omit<ReturnType<typeof useLiveQuery>, "data"> & object;
```

Defined in: [useLiveInfiniteQuery.ts:39](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveInfiniteQuery.ts#L39)
Defined in: [useLiveInfiniteQuery.ts:55](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveInfiniteQuery.ts#L55)

## Type Declaration

Expand All @@ -19,6 +19,12 @@ Defined in: [useLiveInfiniteQuery.ts:39](https://github.com/TanStack/db/blob/mai
data: InferResultType<TContext>;
```

### error

```ts
error: unknown;
```

### fetchNextPage()

```ts
Expand Down
10 changes: 5 additions & 5 deletions docs/framework/solid/reference/functions/useLiveQuery.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ title: useLiveQuery
function useLiveQuery<TContext>(queryFn): Accessor<InferResultType<TContext>> & object;
```

Defined in: [useLiveQuery.ts:102](https://github.com/TanStack/db/blob/main/packages/solid-db/src/useLiveQuery.ts#L102)
Defined in: [useLiveQuery.ts:103](https://github.com/TanStack/db/blob/main/packages/solid-db/src/useLiveQuery.ts#L103)

Create a live query using a query function

Expand Down Expand Up @@ -111,7 +111,7 @@ return (
function useLiveQuery<TContext>(queryFn): Accessor<InferResultType<TContext>> & object;
```

Defined in: [useLiveQuery.ts:121](https://github.com/TanStack/db/blob/main/packages/solid-db/src/useLiveQuery.ts#L121)
Defined in: [useLiveQuery.ts:122](https://github.com/TanStack/db/blob/main/packages/solid-db/src/useLiveQuery.ts#L122)

Create a live query using a query function

Expand Down Expand Up @@ -211,7 +211,7 @@ return (
function useLiveQuery<TContext>(config): Accessor<InferResultType<TContext>> & object;
```

Defined in: [useLiveQuery.ts:182](https://github.com/TanStack/db/blob/main/packages/solid-db/src/useLiveQuery.ts#L182)
Defined in: [useLiveQuery.ts:183](https://github.com/TanStack/db/blob/main/packages/solid-db/src/useLiveQuery.ts#L183)

Create a live query using configuration object

Expand Down Expand Up @@ -280,7 +280,7 @@ return (
function useLiveQuery<TResult, TKey, TUtils>(liveQueryCollection): Accessor<TResult[]> & object;
```

Defined in: [useLiveQuery.ts:236](https://github.com/TanStack/db/blob/main/packages/solid-db/src/useLiveQuery.ts#L236)
Defined in: [useLiveQuery.ts:237](https://github.com/TanStack/db/blob/main/packages/solid-db/src/useLiveQuery.ts#L237)

Subscribe to an existing live query collection

Expand Down Expand Up @@ -352,7 +352,7 @@ return (
function useLiveQuery<TResult, TKey, TUtils>(liveQueryCollection): Accessor<TResult | undefined> & object;
```

Defined in: [useLiveQuery.ts:261](https://github.com/TanStack/db/blob/main/packages/solid-db/src/useLiveQuery.ts#L261)
Defined in: [useLiveQuery.ts:262](https://github.com/TanStack/db/blob/main/packages/solid-db/src/useLiveQuery.ts#L262)

Create a live query using a query function

Expand Down
83 changes: 83 additions & 0 deletions docs/framework/svelte/reference/functions/useLiveInfiniteQuery.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
id: useLiveInfiniteQuery
title: useLiveInfiniteQuery
---

# Function: useLiveInfiniteQuery()

## Call Signature

```ts
function useLiveInfiniteQuery<TResult, TKey, TUtils>(liveQueryCollection, config): UseLiveInfiniteQueryReturnWithCollection<TResult, TKey, TUtils>;
```

Defined in: [useLiveInfiniteQuery.svelte.ts:155](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveInfiniteQuery.svelte.ts#L155)

Create a Svelte-native reactive view over the shared live-query window
controller. The query must include an `orderBy` clause.

### Type Parameters

#### TResult

`TResult` *extends* `object`

#### TKey

`TKey` *extends* `string` \| `number`

#### TUtils

`TUtils` *extends* `Record`\<`string`, `any`\>

### Parameters

#### liveQueryCollection

`MaybeGetter`\<`Collection`\<`TResult`, `TKey`, `TUtils`, `StandardSchemaV1`\<`unknown`, `unknown`\>, `TResult`\> & `NonSingleResult`\>

#### config

[`LiveInfiniteQueryConfig`](../type-aliases/LiveInfiniteQueryConfig.md)\<`TResult`\>

### Returns

[`UseLiveInfiniteQueryReturnWithCollection`](../type-aliases/UseLiveInfiniteQueryReturnWithCollection.md)\<`TResult`, `TKey`, `TUtils`\>

## Call Signature

```ts
function useLiveInfiniteQuery<TContext>(
queryFn,
config,
deps?): UseLiveInfiniteQueryReturn<TContext>;
```

Defined in: [useLiveInfiniteQuery.svelte.ts:166](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveInfiniteQuery.svelte.ts#L166)

Create a Svelte-native reactive view over the shared live-query window
controller. The query must include an `orderBy` clause.

### Type Parameters

#### TContext

`TContext` *extends* `Context`

### Parameters

#### queryFn

(`q`) => `QueryBuilder`\<`TContext`\>

#### config

[`UseLiveInfiniteQueryConfig`](../type-aliases/UseLiveInfiniteQueryConfig.md)\<`TContext`\>

#### deps?

() => `unknown`[]

### Returns

[`UseLiveInfiniteQueryReturn`](../type-aliases/UseLiveInfiniteQueryReturn.md)\<`TContext`\>
10 changes: 5 additions & 5 deletions docs/framework/svelte/reference/functions/useLiveQuery.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ title: useLiveQuery
function useLiveQuery<TContext>(queryFn, deps?): UseLiveQueryReturn<{ [K in string | number | symbol]: ResultValue<TContext>[K] }, InferResultType<TContext>>;
```

Defined in: [useLiveQuery.svelte.ts:164](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L164)
Defined in: [useLiveQuery.svelte.ts:166](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L166)

Create a live query using a query function

Expand Down Expand Up @@ -137,7 +137,7 @@ const todosQuery = useLiveQuery((q) =>
function useLiveQuery<TContext>(queryFn, deps?): UseLiveQueryReturn<{ [K in string | number | symbol]: ResultValue<TContext>[K] }, InferResultType<TContext> | undefined>;
```

Defined in: [useLiveQuery.svelte.ts:170](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L170)
Defined in: [useLiveQuery.svelte.ts:172](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L172)

Create a live query using a query function

Expand Down Expand Up @@ -263,7 +263,7 @@ const todosQuery = useLiveQuery((q) =>
function useLiveQuery<TContext>(config, deps?): UseLiveQueryReturn<{ [K in string | number | symbol]: ResultValue<TContext>[K] }, InferResultType<TContext>>;
```

Defined in: [useLiveQuery.svelte.ts:218](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L218)
Defined in: [useLiveQuery.svelte.ts:220](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L220)

Create a live query using configuration object

Expand Down Expand Up @@ -336,7 +336,7 @@ const itemsQuery = useLiveQuery({
function useLiveQuery<TResult, TKey, TUtils>(liveQueryCollection): UseLiveQueryReturnWithCollection<TResult, TKey, TUtils, TResult[]>;
```

Defined in: [useLiveQuery.svelte.ts:267](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L267)
Defined in: [useLiveQuery.svelte.ts:269](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L269)

Subscribe to an existing query collection (can be reactive)

Expand Down Expand Up @@ -419,7 +419,7 @@ const queryResult = useLiveQuery(sharedQuery)
function useLiveQuery<TResult, TKey, TUtils>(liveQueryCollection): UseLiveQueryReturnWithCollection<TResult, TKey, TUtils, TResult | undefined>;
```

Defined in: [useLiveQuery.svelte.ts:278](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L278)
Defined in: [useLiveQuery.svelte.ts:280](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L280)

Create a live query using a query function

Expand Down
8 changes: 8 additions & 0 deletions docs/framework/svelte/reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ title: "@tanstack/svelte-db"
- [UseLiveQueryReturn](interfaces/UseLiveQueryReturn.md)
- [UseLiveQueryReturnWithCollection](interfaces/UseLiveQueryReturnWithCollection.md)

## Type Aliases

- [LiveInfiniteQueryConfig](type-aliases/LiveInfiniteQueryConfig.md)
- [UseLiveInfiniteQueryConfig](type-aliases/UseLiveInfiniteQueryConfig.md)
- [UseLiveInfiniteQueryReturn](type-aliases/UseLiveInfiniteQueryReturn.md)
- [UseLiveInfiniteQueryReturnWithCollection](type-aliases/UseLiveInfiniteQueryReturnWithCollection.md)

## Functions

- [useLiveInfiniteQuery](functions/useLiveInfiniteQuery.md)
- [useLiveQuery](functions/useLiveQuery.md)
20 changes: 10 additions & 10 deletions docs/framework/svelte/reference/interfaces/UseLiveQueryReturn.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: UseLiveQueryReturn

# Interface: UseLiveQueryReturn\<T, TData\>

Defined in: [useLiveQuery.svelte.ts:37](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L37)
Defined in: [useLiveQuery.svelte.ts:39](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L39)

Return type for useLiveQuery hook

Expand All @@ -28,7 +28,7 @@ collection: Collection<T, string | number, {
}>;
```

Defined in: [useLiveQuery.svelte.ts:40](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L40)
Defined in: [useLiveQuery.svelte.ts:42](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L42)

The underlying query collection instance

Expand All @@ -40,7 +40,7 @@ The underlying query collection instance
data: TData;
```

Defined in: [useLiveQuery.svelte.ts:39](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L39)
Defined in: [useLiveQuery.svelte.ts:41](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L41)

Reactive array of query results in order, or single item when using findOne()

Expand All @@ -52,7 +52,7 @@ Reactive array of query results in order, or single item when using findOne()
isCleanedUp: boolean;
```

Defined in: [useLiveQuery.svelte.ts:46](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L46)
Defined in: [useLiveQuery.svelte.ts:48](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L48)

True when query has been cleaned up

Expand All @@ -64,7 +64,7 @@ True when query has been cleaned up
isError: boolean;
```

Defined in: [useLiveQuery.svelte.ts:45](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L45)
Defined in: [useLiveQuery.svelte.ts:47](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L47)

True when query encountered an error

Expand All @@ -76,7 +76,7 @@ True when query encountered an error
isIdle: boolean;
```

Defined in: [useLiveQuery.svelte.ts:44](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L44)
Defined in: [useLiveQuery.svelte.ts:46](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L46)

True when query hasn't started yet

Expand All @@ -88,7 +88,7 @@ True when query hasn't started yet
isLoading: boolean;
```

Defined in: [useLiveQuery.svelte.ts:42](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L42)
Defined in: [useLiveQuery.svelte.ts:44](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L44)

True while initial query data is loading

Expand All @@ -100,7 +100,7 @@ True while initial query data is loading
isReady: boolean;
```

Defined in: [useLiveQuery.svelte.ts:43](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L43)
Defined in: [useLiveQuery.svelte.ts:45](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L45)

True when query has received first data and is ready

Expand All @@ -112,7 +112,7 @@ True when query has received first data and is ready
state: Map<string | number, T>;
```

Defined in: [useLiveQuery.svelte.ts:38](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L38)
Defined in: [useLiveQuery.svelte.ts:40](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L40)

Reactive Map of query results (key → item)

Expand All @@ -124,6 +124,6 @@ Reactive Map of query results (key → item)
status: CollectionStatus;
```

Defined in: [useLiveQuery.svelte.ts:41](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L41)
Defined in: [useLiveQuery.svelte.ts:43](https://github.com/TanStack/db/blob/main/packages/svelte-db/src/useLiveQuery.svelte.ts#L43)

Current query status
Loading