Open History to see the last commit
1---
2id: useLiveInfiniteQuery
3title: useLiveInfiniteQuery
4---
5
6## Call Signature
7
8```ts
9function useLiveInfiniteQuery<TResult, TKey, TUtils>(liveQueryCollection, config): UseLiveInfiniteQueryReturnWithCollection<TResult, TKey, TUtils>;
10```
11
12Defined in: [useLiveInfiniteQuery.ts:129](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveInfiniteQuery.ts#L129)
13
14Create an infinite query using a query function with live updates.
15
16Uses `utils.setWindow()` to dynamically adjust the limit/offset window
17without recreating the live query collection on each page change.
18
19### Type Parameters
20
21#### TResult
22
23`TResult` *extends* `object`
24
25#### TKey
26
27`TKey` *extends* `string` \| `number`
28
29#### TUtils
30
31`TUtils` *extends* `Record`\<`string`, `any`\>
32
33### Parameters
34
35#### liveQueryCollection
36
37`Collection`\<`TResult`, `TKey`, `TUtils`, `StandardSchemaV1`\<`unknown`, `unknown`\>, `TResult`\> & `NonSingleResult`
38
39#### config
40
41[`UseLiveInfiniteQueryConfig`](../type-aliases/UseLiveInfiniteQueryConfig.md)\<`any`\>
42
43Configuration including pageSize and an optional initial page label
44
45### Returns
46
47[`UseLiveInfiniteQueryReturnWithCollection`](../type-aliases/UseLiveInfiniteQueryReturnWithCollection.md)\<`TResult`, `TKey`, `TUtils`\>
48
49Object with pages, data, and pagination controls
50
51## Call Signature
52
53```ts
54function useLiveInfiniteQuery<TContext>(
55 queryFn,
56 config,
57deps?): UseLiveInfiniteQueryReturn<TContext>;
58```
59
60Defined in: [useLiveInfiniteQuery.ts:139](https://github.com/TanStack/db/blob/main/packages/react-db/src/useLiveInfiniteQuery.ts#L139)
61
62Create an infinite query using a query function with live updates.
63
64Uses `utils.setWindow()` to dynamically adjust the limit/offset window
65without recreating the live query collection on each page change.
66
67### Type Parameters
68
69#### TContext
70
71`TContext` *extends* `Context`
72
73### Parameters
74
75#### queryFn
76
77(`q`) => `QueryBuilder`\<`TContext`\>
78
79Query function that defines what data to fetch. Must include `.orderBy()` for setWindow to work.
80
81#### config
82
83[`UseLiveInfiniteQueryConfig`](../type-aliases/UseLiveInfiniteQueryConfig.md)\<`TContext`\>
84
85Configuration including pageSize and an optional initial page label
86
87#### deps?
88
89`unknown`[]
90
91Deprecated array of dependencies that trigger query re-execution when changed
92
93### Returns
94
95[`UseLiveInfiniteQueryReturn`](../type-aliases/UseLiveInfiniteQueryReturn.md)\<`TContext`\>
96
97Object with pages, data, and pagination controls