Skip to content
Source
Sign inSign up
TanStack/db
Open History to see the last commit

pooledLiveQueries.md

64 lines1.5 KB

1---
2id: pooledLiveQueries
3title: pooledLiveQueries
4---
5​
6```ts
7const pooledLiveQueries: object;
8```
9​
10Defined in: [packages/db/src/query/pooled-live-query.ts:878](https://github.com/TanStack/db/blob/main/packages/db/src/query/pooled-live-query.ts#L878)
11​
12Pooled live queries for framework hooks. Pass it as `pool` in a hook's
13query config to serve equality-filtered queries of one shape from a shared
14partition. Apps that do not pass it do not bundle pooling.
15​
16## Type Declaration
17​
18### createPooledLiveQuery()
19​
20```ts
21createPooledLiveQuery: (query, __namedParameters) =>
22 | Collection<any, any, any, StandardSchemaV1<unknown, unknown>, any>
23 | undefined;
24```
25​
26A pooled view for a query a partition can serve, or undefined. The view is
27typed as the Collection it stands in for.
28​
29#### Parameters
30​
31##### query
32​
33[`BaseQueryBuilder`](../classes/BaseQueryBuilder.md)
34​
35##### \_\_namedParameters
36​
37###### gcTime?
38​
39`number` = `5_000`
40​
41#### Returns
42​
43 \| [`Collection`](../interfaces/Collection.md)\<`any`, `any`, `any`, `StandardSchemaV1`\<`unknown`, `unknown`\>, `any`\>
44 \| `undefined`
45​
46### getPooledQueryIdentity()
47​
48```ts
49getPooledQueryIdentity: (query) => string | undefined;
50```
51​
52The identity of a query a partition can serve with no residual conjunct:
53its source and its `eq` fields and literals, which determine its rows.
54Undefined for any other query, which keeps the full structural identity.
55​
56#### Parameters
57​
58##### query
59​
60[`BaseQueryBuilder`](../classes/BaseQueryBuilder.md)
61​
62#### Returns
63​
64`string` \| `undefined`