From 30b804c0004fc2b81b11a5ed91d760d4617c98b8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 22 Jul 2026 14:30:54 +0000 Subject: [PATCH] docs: regenerate API documentation --- .../DeleteOperationItemNotFoundError.md | 4 +- .../classes/DuplicateKeyInBatchError.md | 4 +- .../classes/InitialDataInOnDemandModeError.md | 214 ++++++++++++++++++ .../classes/InvalidItemStructureError.md | 4 +- .../classes/InvalidSyncOperationError.md | 4 +- .../classes/ItemNotFoundError.md | 4 +- .../classes/MissingKeyFieldError.md | 4 +- .../classes/QueryCollectionError.md | 1 + .../classes/SyncNotInitializedError.md | 4 +- .../classes/UnknownOperationTypeError.md | 4 +- .../UpdateOperationItemNotFoundError.md | 4 +- .../functions/queryCollectionOptions.md | 8 +- docs/reference/query-db-collection/index.md | 1 + .../interfaces/QueryCollectionConfig.md | 60 +++-- .../interfaces/QueryCollectionUtils.md | 32 +-- 15 files changed, 297 insertions(+), 55 deletions(-) create mode 100644 docs/reference/query-db-collection/classes/InitialDataInOnDemandModeError.md diff --git a/docs/reference/query-db-collection/classes/DeleteOperationItemNotFoundError.md b/docs/reference/query-db-collection/classes/DeleteOperationItemNotFoundError.md index 925711239a..2655d95a22 100644 --- a/docs/reference/query-db-collection/classes/DeleteOperationItemNotFoundError.md +++ b/docs/reference/query-db-collection/classes/DeleteOperationItemNotFoundError.md @@ -5,7 +5,7 @@ title: DeleteOperationItemNotFoundError # Class: DeleteOperationItemNotFoundError -Defined in: [packages/query-db-collection/src/errors.ts:76](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L76) +Defined in: [packages/query-db-collection/src/errors.ts:85](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L85) ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/query-db-collection/src/errors.ts:76](https://github.com/T new DeleteOperationItemNotFoundError(key): DeleteOperationItemNotFoundError; ``` -Defined in: [packages/query-db-collection/src/errors.ts:77](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L77) +Defined in: [packages/query-db-collection/src/errors.ts:86](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L86) #### Parameters diff --git a/docs/reference/query-db-collection/classes/DuplicateKeyInBatchError.md b/docs/reference/query-db-collection/classes/DuplicateKeyInBatchError.md index 7eeb9248fa..9d342a37a4 100644 --- a/docs/reference/query-db-collection/classes/DuplicateKeyInBatchError.md +++ b/docs/reference/query-db-collection/classes/DuplicateKeyInBatchError.md @@ -5,7 +5,7 @@ title: DuplicateKeyInBatchError # Class: DuplicateKeyInBatchError -Defined in: [packages/query-db-collection/src/errors.ts:62](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L62) +Defined in: [packages/query-db-collection/src/errors.ts:71](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L71) ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/query-db-collection/src/errors.ts:62](https://github.com/T new DuplicateKeyInBatchError(key): DuplicateKeyInBatchError; ``` -Defined in: [packages/query-db-collection/src/errors.ts:63](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L63) +Defined in: [packages/query-db-collection/src/errors.ts:72](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L72) #### Parameters diff --git a/docs/reference/query-db-collection/classes/InitialDataInOnDemandModeError.md b/docs/reference/query-db-collection/classes/InitialDataInOnDemandModeError.md new file mode 100644 index 0000000000..3c1822a478 --- /dev/null +++ b/docs/reference/query-db-collection/classes/InitialDataInOnDemandModeError.md @@ -0,0 +1,214 @@ +--- +id: InitialDataInOnDemandModeError +title: InitialDataInOnDemandModeError +--- + +# Class: InitialDataInOnDemandModeError + +Defined in: [packages/query-db-collection/src/errors.ts:39](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L39) + +## Extends + +- [`QueryCollectionError`](QueryCollectionError.md) + +## Constructors + +### Constructor + +```ts +new InitialDataInOnDemandModeError(): InitialDataInOnDemandModeError; +``` + +Defined in: [packages/query-db-collection/src/errors.ts:40](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L40) + +#### Returns + +`InitialDataInOnDemandModeError` + +#### Overrides + +[`QueryCollectionError`](QueryCollectionError.md).[`constructor`](QueryCollectionError.md#constructor) + +## Properties + +### cause? + +```ts +optional cause: unknown; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26 + +#### Inherited from + +[`QueryCollectionError`](QueryCollectionError.md).[`cause`](QueryCollectionError.md#cause) + +*** + +### message + +```ts +message: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077 + +#### Inherited from + +[`QueryCollectionError`](QueryCollectionError.md).[`message`](QueryCollectionError.md#message) + +*** + +### name + +```ts +name: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 + +#### Inherited from + +[`QueryCollectionError`](QueryCollectionError.md).[`name`](QueryCollectionError.md#name) + +*** + +### stack? + +```ts +optional stack: string; +``` + +Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078 + +#### Inherited from + +[`QueryCollectionError`](QueryCollectionError.md).[`stack`](QueryCollectionError.md#stack) + +*** + +### stackTraceLimit + +```ts +static stackTraceLimit: number; +``` + +Defined in: node\_modules/.pnpm/@types+node@25.2.2/node\_modules/@types/node/globals.d.ts:67 + +The `Error.stackTraceLimit` property specifies the number of stack frames +collected by a stack trace (whether generated by `new Error().stack` or +`Error.captureStackTrace(obj)`). + +The default value is `10` but may be set to any valid JavaScript number. Changes +will affect any stack trace captured _after_ the value has been changed. + +If set to a non-number value, or set to a negative number, stack traces will +not capture any frames. + +#### Inherited from + +[`QueryCollectionError`](QueryCollectionError.md).[`stackTraceLimit`](QueryCollectionError.md#stacktracelimit) + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void; +``` + +Defined in: node\_modules/.pnpm/@types+node@25.2.2/node\_modules/@types/node/globals.d.ts:51 + +Creates a `.stack` property on `targetObject`, which when accessed returns +a string representing the location in the code at which +`Error.captureStackTrace()` was called. + +```js +const myObject = {}; +Error.captureStackTrace(myObject); +myObject.stack; // Similar to `new Error().stack` +``` + +The first line of the trace will be prefixed with +`${myObject.name}: ${myObject.message}`. + +The optional `constructorOpt` argument accepts a function. If given, all frames +above `constructorOpt`, including `constructorOpt`, will be omitted from the +generated stack trace. + +The `constructorOpt` argument is useful for hiding implementation +details of error generation from the user. For instance: + +```js +function a() { + b(); +} + +function b() { + c(); +} + +function c() { + // Create an error without stack trace to avoid calculating the stack trace twice. + const { stackTraceLimit } = Error; + Error.stackTraceLimit = 0; + const error = new Error(); + Error.stackTraceLimit = stackTraceLimit; + + // Capture the stack trace above function b + Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace + throw error; +} + +a(); +``` + +#### Parameters + +##### targetObject + +`object` + +##### constructorOpt? + +`Function` + +#### Returns + +`void` + +#### Inherited from + +[`QueryCollectionError`](QueryCollectionError.md).[`captureStackTrace`](QueryCollectionError.md#capturestacktrace) + +*** + +### prepareStackTrace() + +```ts +static prepareStackTrace(err, stackTraces): any; +``` + +Defined in: node\_modules/.pnpm/@types+node@25.2.2/node\_modules/@types/node/globals.d.ts:55 + +#### Parameters + +##### err + +`Error` + +##### stackTraces + +`CallSite`[] + +#### Returns + +`any` + +#### See + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Inherited from + +[`QueryCollectionError`](QueryCollectionError.md).[`prepareStackTrace`](QueryCollectionError.md#preparestacktrace) diff --git a/docs/reference/query-db-collection/classes/InvalidItemStructureError.md b/docs/reference/query-db-collection/classes/InvalidItemStructureError.md index 7b01648f54..99389fe3f7 100644 --- a/docs/reference/query-db-collection/classes/InvalidItemStructureError.md +++ b/docs/reference/query-db-collection/classes/InvalidItemStructureError.md @@ -5,7 +5,7 @@ title: InvalidItemStructureError # Class: InvalidItemStructureError -Defined in: [packages/query-db-collection/src/errors.ts:48](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L48) +Defined in: [packages/query-db-collection/src/errors.ts:57](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L57) ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/query-db-collection/src/errors.ts:48](https://github.com/T new InvalidItemStructureError(message): InvalidItemStructureError; ``` -Defined in: [packages/query-db-collection/src/errors.ts:49](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L49) +Defined in: [packages/query-db-collection/src/errors.ts:58](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L58) #### Parameters diff --git a/docs/reference/query-db-collection/classes/InvalidSyncOperationError.md b/docs/reference/query-db-collection/classes/InvalidSyncOperationError.md index 2691b6f06d..797b887d87 100644 --- a/docs/reference/query-db-collection/classes/InvalidSyncOperationError.md +++ b/docs/reference/query-db-collection/classes/InvalidSyncOperationError.md @@ -5,7 +5,7 @@ title: InvalidSyncOperationError # Class: InvalidSyncOperationError -Defined in: [packages/query-db-collection/src/errors.ts:83](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L83) +Defined in: [packages/query-db-collection/src/errors.ts:92](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L92) ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/query-db-collection/src/errors.ts:83](https://github.com/T new InvalidSyncOperationError(message): InvalidSyncOperationError; ``` -Defined in: [packages/query-db-collection/src/errors.ts:84](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L84) +Defined in: [packages/query-db-collection/src/errors.ts:93](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L93) #### Parameters diff --git a/docs/reference/query-db-collection/classes/ItemNotFoundError.md b/docs/reference/query-db-collection/classes/ItemNotFoundError.md index 85c1400f60..21326a6bd3 100644 --- a/docs/reference/query-db-collection/classes/ItemNotFoundError.md +++ b/docs/reference/query-db-collection/classes/ItemNotFoundError.md @@ -5,7 +5,7 @@ title: ItemNotFoundError # Class: ItemNotFoundError -Defined in: [packages/query-db-collection/src/errors.ts:55](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L55) +Defined in: [packages/query-db-collection/src/errors.ts:64](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L64) ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/query-db-collection/src/errors.ts:55](https://github.com/T new ItemNotFoundError(key): ItemNotFoundError; ``` -Defined in: [packages/query-db-collection/src/errors.ts:56](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L56) +Defined in: [packages/query-db-collection/src/errors.ts:65](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L65) #### Parameters diff --git a/docs/reference/query-db-collection/classes/MissingKeyFieldError.md b/docs/reference/query-db-collection/classes/MissingKeyFieldError.md index 3c44dc2aca..3fc58996d5 100644 --- a/docs/reference/query-db-collection/classes/MissingKeyFieldError.md +++ b/docs/reference/query-db-collection/classes/MissingKeyFieldError.md @@ -5,7 +5,7 @@ title: MissingKeyFieldError # Class: MissingKeyFieldError -Defined in: [packages/query-db-collection/src/errors.ts:97](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L97) +Defined in: [packages/query-db-collection/src/errors.ts:106](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L106) ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/query-db-collection/src/errors.ts:97](https://github.com/T new MissingKeyFieldError(operation, message): MissingKeyFieldError; ``` -Defined in: [packages/query-db-collection/src/errors.ts:98](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L98) +Defined in: [packages/query-db-collection/src/errors.ts:107](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L107) #### Parameters diff --git a/docs/reference/query-db-collection/classes/QueryCollectionError.md b/docs/reference/query-db-collection/classes/QueryCollectionError.md index 9e3c7fce57..01d33ccc15 100644 --- a/docs/reference/query-db-collection/classes/QueryCollectionError.md +++ b/docs/reference/query-db-collection/classes/QueryCollectionError.md @@ -17,6 +17,7 @@ Defined in: [packages/query-db-collection/src/errors.ts:4](https://github.com/Ta - [`QueryFnRequiredError`](QueryFnRequiredError.md) - [`QueryClientRequiredError`](QueryClientRequiredError.md) - [`GetKeyRequiredError`](GetKeyRequiredError.md) +- [`InitialDataInOnDemandModeError`](InitialDataInOnDemandModeError.md) - [`SyncNotInitializedError`](SyncNotInitializedError.md) - [`InvalidItemStructureError`](InvalidItemStructureError.md) - [`ItemNotFoundError`](ItemNotFoundError.md) diff --git a/docs/reference/query-db-collection/classes/SyncNotInitializedError.md b/docs/reference/query-db-collection/classes/SyncNotInitializedError.md index 8e5a132f5a..f8954b8eb1 100644 --- a/docs/reference/query-db-collection/classes/SyncNotInitializedError.md +++ b/docs/reference/query-db-collection/classes/SyncNotInitializedError.md @@ -5,7 +5,7 @@ title: SyncNotInitializedError # Class: SyncNotInitializedError -Defined in: [packages/query-db-collection/src/errors.ts:39](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L39) +Defined in: [packages/query-db-collection/src/errors.ts:48](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L48) ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/query-db-collection/src/errors.ts:39](https://github.com/T new SyncNotInitializedError(): SyncNotInitializedError; ``` -Defined in: [packages/query-db-collection/src/errors.ts:40](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L40) +Defined in: [packages/query-db-collection/src/errors.ts:49](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L49) #### Returns diff --git a/docs/reference/query-db-collection/classes/UnknownOperationTypeError.md b/docs/reference/query-db-collection/classes/UnknownOperationTypeError.md index ab9b767152..f4392d794a 100644 --- a/docs/reference/query-db-collection/classes/UnknownOperationTypeError.md +++ b/docs/reference/query-db-collection/classes/UnknownOperationTypeError.md @@ -5,7 +5,7 @@ title: UnknownOperationTypeError # Class: UnknownOperationTypeError -Defined in: [packages/query-db-collection/src/errors.ts:90](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L90) +Defined in: [packages/query-db-collection/src/errors.ts:99](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L99) ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/query-db-collection/src/errors.ts:90](https://github.com/T new UnknownOperationTypeError(type): UnknownOperationTypeError; ``` -Defined in: [packages/query-db-collection/src/errors.ts:91](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L91) +Defined in: [packages/query-db-collection/src/errors.ts:100](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L100) #### Parameters diff --git a/docs/reference/query-db-collection/classes/UpdateOperationItemNotFoundError.md b/docs/reference/query-db-collection/classes/UpdateOperationItemNotFoundError.md index 304555e780..d2ae0ed614 100644 --- a/docs/reference/query-db-collection/classes/UpdateOperationItemNotFoundError.md +++ b/docs/reference/query-db-collection/classes/UpdateOperationItemNotFoundError.md @@ -5,7 +5,7 @@ title: UpdateOperationItemNotFoundError # Class: UpdateOperationItemNotFoundError -Defined in: [packages/query-db-collection/src/errors.ts:69](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L69) +Defined in: [packages/query-db-collection/src/errors.ts:78](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L78) ## Extends @@ -19,7 +19,7 @@ Defined in: [packages/query-db-collection/src/errors.ts:69](https://github.com/T new UpdateOperationItemNotFoundError(key): UpdateOperationItemNotFoundError; ``` -Defined in: [packages/query-db-collection/src/errors.ts:70](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L70) +Defined in: [packages/query-db-collection/src/errors.ts:79](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/errors.ts#L79) #### Parameters diff --git a/docs/reference/query-db-collection/functions/queryCollectionOptions.md b/docs/reference/query-db-collection/functions/queryCollectionOptions.md index 5da712517b..8984ed90db 100644 --- a/docs/reference/query-db-collection/functions/queryCollectionOptions.md +++ b/docs/reference/query-db-collection/functions/queryCollectionOptions.md @@ -11,7 +11,7 @@ title: queryCollectionOptions function queryCollectionOptions(config): CollectionConfig, TKey, T, QueryCollectionUtils, TKey, InferSchemaInput, TError>> & object; ``` -Defined in: [packages/query-db-collection/src/query.ts:510](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L510) +Defined in: [packages/query-db-collection/src/query.ts:531](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L531) Creates query collection options for use with a standard Collection. This integrates TanStack Query with TanStack DB for automatic synchronization. @@ -151,7 +151,7 @@ const todosCollection = createCollection( function queryCollectionOptions(config): CollectionConfig> & object; ``` -Defined in: [packages/query-db-collection/src/query.ts:545](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L545) +Defined in: [packages/query-db-collection/src/query.ts:566](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L566) Creates query collection options for use with a standard Collection. This integrates TanStack Query with TanStack DB for automatic synchronization. @@ -291,7 +291,7 @@ const todosCollection = createCollection( function queryCollectionOptions(config): CollectionConfig, TKey, T, QueryCollectionUtils, TKey, InferSchemaInput, TError>> & object; ``` -Defined in: [packages/query-db-collection/src/query.ts:578](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L578) +Defined in: [packages/query-db-collection/src/query.ts:599](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L599) Creates query collection options for use with a standard Collection. This integrates TanStack Query with TanStack DB for automatic synchronization. @@ -423,7 +423,7 @@ const todosCollection = createCollection( function queryCollectionOptions(config): CollectionConfig> & object; ``` -Defined in: [packages/query-db-collection/src/query.ts:612](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L612) +Defined in: [packages/query-db-collection/src/query.ts:633](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L633) Creates query collection options for use with a standard Collection. This integrates TanStack Query with TanStack DB for automatic synchronization. diff --git a/docs/reference/query-db-collection/index.md b/docs/reference/query-db-collection/index.md index 569ee31dde..a25e301173 100644 --- a/docs/reference/query-db-collection/index.md +++ b/docs/reference/query-db-collection/index.md @@ -10,6 +10,7 @@ title: "@tanstack/query-db-collection" - [DeleteOperationItemNotFoundError](classes/DeleteOperationItemNotFoundError.md) - [DuplicateKeyInBatchError](classes/DuplicateKeyInBatchError.md) - [GetKeyRequiredError](classes/GetKeyRequiredError.md) +- [InitialDataInOnDemandModeError](classes/InitialDataInOnDemandModeError.md) - [InvalidItemStructureError](classes/InvalidItemStructureError.md) - [InvalidSyncOperationError](classes/InvalidSyncOperationError.md) - [ItemNotFoundError](classes/ItemNotFoundError.md) diff --git a/docs/reference/query-db-collection/interfaces/QueryCollectionConfig.md b/docs/reference/query-db-collection/interfaces/QueryCollectionConfig.md index bbe7bf8f69..123e7606e9 100644 --- a/docs/reference/query-db-collection/interfaces/QueryCollectionConfig.md +++ b/docs/reference/query-db-collection/interfaces/QueryCollectionConfig.md @@ -5,7 +5,7 @@ title: QueryCollectionConfig # Interface: QueryCollectionConfig\ -Defined in: [packages/query-db-collection/src/query.ts:95](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L95) +Defined in: [packages/query-db-collection/src/query.ts:96](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L96) Configuration options for creating a Query Collection @@ -63,7 +63,7 @@ The schema type for validation optional enabled: Enabled; ``` -Defined in: [packages/query-db-collection/src/query.ts:124](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L124) +Defined in: [packages/query-db-collection/src/query.ts:125](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L125) Whether the query should automatically run (default: true) @@ -75,7 +75,7 @@ Whether the query should automatically run (default: true) optional gcTime: number; ``` -Defined in: [packages/query-db-collection/src/query.ts:159](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L159) +Defined in: [packages/query-db-collection/src/query.ts:160](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L160) Time in milliseconds after which the collection will be garbage collected when it has no active subscribers. Defaults to 5 minutes (300000ms). @@ -88,13 +88,39 @@ BaseCollectionConfig.gcTime *** +### initialData? + +```ts +optional initialData: TQueryData | InitialDataFunction; +``` + +Defined in: [packages/query-db-collection/src/query.ts:200](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L200) + +Data used to initialize the TanStack Query cache for an eager collection. +The value has the original Query response shape and is projected through +the collection's select option before rows are materialized. + +*** + +### initialDataUpdatedAt? + +```ts +optional initialDataUpdatedAt: number | () => number | undefined; +``` + +Defined in: [packages/query-db-collection/src/query.ts:208](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L208) + +The timestamp TanStack Query uses to determine initialData freshness. + +*** + ### meta? ```ts optional meta: Record; ``` -Defined in: [packages/query-db-collection/src/query.ts:216](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L216) +Defined in: [packages/query-db-collection/src/query.ts:237](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L237) Metadata to pass to the query. Available in queryFn via context.meta @@ -126,7 +152,7 @@ meta: { optional networkMode: NetworkMode; ``` -Defined in: [packages/query-db-collection/src/query.ts:187](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L187) +Defined in: [packages/query-db-collection/src/query.ts:188](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L188) *** @@ -136,7 +162,7 @@ Defined in: [packages/query-db-collection/src/query.ts:187](https://github.com/T optional persistedGcTime: number; ``` -Defined in: [packages/query-db-collection/src/query.ts:194](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L194) +Defined in: [packages/query-db-collection/src/query.ts:215](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L215) *** @@ -146,7 +172,7 @@ Defined in: [packages/query-db-collection/src/query.ts:194](https://github.com/T queryClient: QueryClient; ``` -Defined in: [packages/query-db-collection/src/query.ts:120](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L120) +Defined in: [packages/query-db-collection/src/query.ts:121](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L121) The TanStack Query client instance @@ -158,7 +184,7 @@ The TanStack Query client instance queryFn: TQueryFn extends (context) => any[] | Promise ? (context) => T[] | Promise : TQueryFn; ``` -Defined in: [packages/query-db-collection/src/query.ts:109](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L109) +Defined in: [packages/query-db-collection/src/query.ts:110](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L110) Function that fetches data from the server. Must return the complete collection state @@ -170,7 +196,7 @@ Function that fetches data from the server. Must return the complete collection queryKey: TQueryKey | TQueryKeyBuilder; ``` -Defined in: [packages/query-db-collection/src/query.ts:107](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L107) +Defined in: [packages/query-db-collection/src/query.ts:108](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L108) The query key used by TanStack Query to identify this query @@ -182,7 +208,7 @@ The query key used by TanStack Query to identify this query optional refetchInterval: number | false | (query) => number | false | undefined; ``` -Defined in: [packages/query-db-collection/src/query.ts:131](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L131) +Defined in: [packages/query-db-collection/src/query.ts:132](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L132) *** @@ -192,7 +218,7 @@ Defined in: [packages/query-db-collection/src/query.ts:131](https://github.com/T optional refetchOnMount: boolean | "always" | (query) => boolean | "always"; ``` -Defined in: [packages/query-db-collection/src/query.ts:180](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L180) +Defined in: [packages/query-db-collection/src/query.ts:181](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L181) *** @@ -202,7 +228,7 @@ Defined in: [packages/query-db-collection/src/query.ts:180](https://github.com/T optional refetchOnReconnect: boolean | "always" | (query) => boolean | "always"; ``` -Defined in: [packages/query-db-collection/src/query.ts:173](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L173) +Defined in: [packages/query-db-collection/src/query.ts:174](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L174) *** @@ -212,7 +238,7 @@ Defined in: [packages/query-db-collection/src/query.ts:173](https://github.com/T optional refetchOnWindowFocus: boolean | "always" | (query) => boolean | "always"; ``` -Defined in: [packages/query-db-collection/src/query.ts:166](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L166) +Defined in: [packages/query-db-collection/src/query.ts:167](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L167) *** @@ -222,7 +248,7 @@ Defined in: [packages/query-db-collection/src/query.ts:166](https://github.com/T optional retry: RetryValue; ``` -Defined in: [packages/query-db-collection/src/query.ts:138](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L138) +Defined in: [packages/query-db-collection/src/query.ts:139](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L139) *** @@ -232,7 +258,7 @@ Defined in: [packages/query-db-collection/src/query.ts:138](https://github.com/T optional retryDelay: RetryDelayValue; ``` -Defined in: [packages/query-db-collection/src/query.ts:145](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L145) +Defined in: [packages/query-db-collection/src/query.ts:146](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L146) *** @@ -242,7 +268,7 @@ Defined in: [packages/query-db-collection/src/query.ts:145](https://github.com/T optional select: (data) => T[]; ``` -Defined in: [packages/query-db-collection/src/query.ts:118](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L118) +Defined in: [packages/query-db-collection/src/query.ts:119](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L119) Extracts the row array TanStack DB materializes from the Query response. The Query cache keeps the original response shape. @@ -265,4 +291,4 @@ The Query cache keeps the original response shape. optional staleTime: StaleTimeFunction; ``` -Defined in: [packages/query-db-collection/src/query.ts:152](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L152) +Defined in: [packages/query-db-collection/src/query.ts:153](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L153) diff --git a/docs/reference/query-db-collection/interfaces/QueryCollectionUtils.md b/docs/reference/query-db-collection/interfaces/QueryCollectionUtils.md index b2ab5a7c36..2bfe98b3b5 100644 --- a/docs/reference/query-db-collection/interfaces/QueryCollectionUtils.md +++ b/docs/reference/query-db-collection/interfaces/QueryCollectionUtils.md @@ -5,7 +5,7 @@ title: QueryCollectionUtils # Interface: QueryCollectionUtils\ -Defined in: [packages/query-db-collection/src/query.ts:235](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L235) +Defined in: [packages/query-db-collection/src/query.ts:256](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L256) Utility methods available on Query Collections for direct writes and manual operations. Direct writes bypass the normal query/mutation flow and write directly to the synced data store. @@ -54,7 +54,7 @@ The type of errors that can occur during queries clearError: () => Promise; ``` -Defined in: [packages/query-db-collection/src/query.ts:280](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L280) +Defined in: [packages/query-db-collection/src/query.ts:301](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L301) Clear the error state and trigger a refetch of the query @@ -76,7 +76,7 @@ Error if the refetch fails dataUpdatedAt: number; ``` -Defined in: [packages/query-db-collection/src/query.ts:271](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L271) +Defined in: [packages/query-db-collection/src/query.ts:292](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L292) Get timestamp of last successful data update (in milliseconds) @@ -88,7 +88,7 @@ Get timestamp of last successful data update (in milliseconds) errorCount: number; ``` -Defined in: [packages/query-db-collection/src/query.ts:263](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L263) +Defined in: [packages/query-db-collection/src/query.ts:284](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L284) Get the number of consecutive sync failures. Incremented only when query fails completely (not per retry attempt); reset on success. @@ -101,7 +101,7 @@ Incremented only when query fails completely (not per retry attempt); reset on s fetchStatus: "idle" | "fetching" | "paused"; ``` -Defined in: [packages/query-db-collection/src/query.ts:273](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L273) +Defined in: [packages/query-db-collection/src/query.ts:294](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L294) Get current fetch status @@ -113,7 +113,7 @@ Get current fetch status isError: boolean; ``` -Defined in: [packages/query-db-collection/src/query.ts:258](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L258) +Defined in: [packages/query-db-collection/src/query.ts:279](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L279) Check if the collection is in an error state @@ -125,7 +125,7 @@ Check if the collection is in an error state isFetching: boolean; ``` -Defined in: [packages/query-db-collection/src/query.ts:265](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L265) +Defined in: [packages/query-db-collection/src/query.ts:286](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L286) Check if query is currently fetching (initial or background) @@ -137,7 +137,7 @@ Check if query is currently fetching (initial or background) isLoading: boolean; ``` -Defined in: [packages/query-db-collection/src/query.ts:269](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L269) +Defined in: [packages/query-db-collection/src/query.ts:290](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L290) Check if query is loading for the first time (no data yet) @@ -149,7 +149,7 @@ Check if query is loading for the first time (no data yet) isRefetching: boolean; ``` -Defined in: [packages/query-db-collection/src/query.ts:267](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L267) +Defined in: [packages/query-db-collection/src/query.ts:288](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L288) Check if query is refetching in background (not initial fetch) @@ -161,7 +161,7 @@ Check if query is refetching in background (not initial fetch) lastError: TError | undefined; ``` -Defined in: [packages/query-db-collection/src/query.ts:256](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L256) +Defined in: [packages/query-db-collection/src/query.ts:277](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L277) Get the last error encountered by the query (if any); reset on success @@ -173,7 +173,7 @@ Get the last error encountered by the query (if any); reset on success refetch: RefetchFn; ``` -Defined in: [packages/query-db-collection/src/query.ts:242](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L242) +Defined in: [packages/query-db-collection/src/query.ts:263](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L263) Manually trigger a refetch of the query @@ -185,7 +185,7 @@ Manually trigger a refetch of the query writeBatch: (callback) => void; ``` -Defined in: [packages/query-db-collection/src/query.ts:252](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L252) +Defined in: [packages/query-db-collection/src/query.ts:273](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L273) Execute multiple write operations as a single atomic batch to the synced data store @@ -207,7 +207,7 @@ Execute multiple write operations as a single atomic batch to the synced data st writeDelete: (keys) => void; ``` -Defined in: [packages/query-db-collection/src/query.ts:248](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L248) +Defined in: [packages/query-db-collection/src/query.ts:269](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L269) Delete one or more items directly from the synced data store without triggering a query refetch or optimistic update @@ -229,7 +229,7 @@ Delete one or more items directly from the synced data store without triggering writeInsert: (data) => void; ``` -Defined in: [packages/query-db-collection/src/query.ts:244](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L244) +Defined in: [packages/query-db-collection/src/query.ts:265](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L265) Insert one or more items directly into the synced data store without triggering a query refetch or optimistic update @@ -251,7 +251,7 @@ Insert one or more items directly into the synced data store without triggering writeUpdate: (updates) => void; ``` -Defined in: [packages/query-db-collection/src/query.ts:246](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L246) +Defined in: [packages/query-db-collection/src/query.ts:267](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L267) Update one or more items directly in the synced data store without triggering a query refetch or optimistic update @@ -273,7 +273,7 @@ Update one or more items directly in the synced data store without triggering a writeUpsert: (data) => void; ``` -Defined in: [packages/query-db-collection/src/query.ts:250](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L250) +Defined in: [packages/query-db-collection/src/query.ts:271](https://github.com/TanStack/db/blob/main/packages/query-db-collection/src/query.ts#L271) Insert or update one or more items directly in the synced data store without triggering a query refetch or optimistic update