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

configPool.md

89 lines2.0 KB

1---
2id: configPool
3title: configPool
4---
5​
6```ts
7function configPool(config):
8 | {
9 createPooledLiveQuery: (query, __namedParameters) =>
10 | Collection<any, any, any, StandardSchemaV1<unknown, unknown>, any>
11 | undefined;
12 getPooledQueryIdentity: (query) => string | undefined;
14 | undefined;
15```
16​
17Defined in: [packages/db/src/live-query-options.ts:35](https://github.com/TanStack/db/blob/main/packages/db/src/live-query-options.ts#L35)
18​
19A hook config's pool: `pooledLiveQueries` or nothing. Any other value, such
20as the removed boolean form, contradicts the hook contract, so every reader
21rejects it the same way, whatever the config's other options. An adapter
22that reads the pool from its own options, as Angular does, checks it here.
23​
24## Parameters
25​
26### config
27​
28`object`
29​
30## Returns
31​
32```ts
34 createPooledLiveQuery: (query, __namedParameters) =>
35 | Collection<any, any, any, StandardSchemaV1<unknown, unknown>, any>
36 | undefined;
37 getPooledQueryIdentity: (query) => string | undefined;
39```
40​
41### createPooledLiveQuery()
42​
43```ts
44createPooledLiveQuery: (query, __namedParameters) =>
45 | Collection<any, any, any, StandardSchemaV1<unknown, unknown>, any>
46 | undefined;
47```
48​
49A pooled view for a query a partition can serve, or undefined. The view is
50typed as the Collection it stands in for.
51​
52#### Parameters
53​
54##### query
55​
56[`BaseQueryBuilder`](../classes/BaseQueryBuilder.md)
57​
58##### \_\_namedParameters
59​
60###### gcTime?
61​
62`number` = `5_000`
63​
64#### Returns
65​
66 \| [`Collection`](../interfaces/Collection.md)\<`any`, `any`, `any`, `StandardSchemaV1`\<`unknown`, `unknown`\>, `any`\>
67 \| `undefined`
68​
69### getPooledQueryIdentity()
70​
71```ts
72getPooledQueryIdentity: (query) => string | undefined;
73```
74​
75The identity of a query a partition can serve with no residual conjunct:
76its source and its `eq` fields and literals, which determine its rows.
77Undefined for any other query, which keeps the full structural identity.
78​
79#### Parameters
80​
81##### query
82​
83[`BaseQueryBuilder`](../classes/BaseQueryBuilder.md)
84​
85#### Returns
86​
87`string` \| `undefined`
88​
89`undefined`