Skip to content

Latest commit

 

History

History
172 lines (101 loc) · 3.21 KB

File metadata and controls

172 lines (101 loc) · 3.21 KB
id SubscribeChangesSnapshotOptions
title SubscribeChangesSnapshotOptions

Interface: SubscribeChangesSnapshotOptions<T>

Defined in: packages/db/src/types.ts:830

Extends

Type Parameters

T

T extends object = Record<string, unknown>

Properties

limit?

optional limit: number;

Defined in: packages/db/src/types.ts:834

Internal

Optional limit to include in loadSubset for query-specific cache keys.

Overrides

SubscribeChangesOptions.limit


onLoadSubsetResult()?

optional onLoadSubsetResult: (result) => void;

Defined in: packages/db/src/types.ts:827

Internal

Callback that receives the loadSubset result (Promise or true) from requestSnapshot. Allows the caller to directly track the loading promise for isReady status.

Parameters

result

true | Promise<void>

Returns

void

Inherited from

Omit.onLoadSubsetResult

onStatusChange()?

optional onStatusChange: (event) => void;

Defined in: packages/db/src/types.ts:811

Internal

Listener for subscription status changes. Registered BEFORE any snapshot is requested, ensuring no status transitions are missed.

Parameters

event

SubscriptionStatusChangeEvent

Returns

void

Inherited from

Omit.onStatusChange

orderBy?

optional orderBy: OrderBy;

Defined in: packages/db/src/types.ts:833

Internal

Optional orderBy to include in loadSubset for query-specific cache keys.

Overrides

SubscribeChangesOptions.orderBy


where()?

optional where: (row) => any;

Defined in: packages/db/src/types.ts:803

Callback function for filtering changes using a row proxy. The callback receives a proxy object that records property access, allowing you to use query builder functions like eq, gt, etc.

Parameters

row

SingleRowRefProxy<T>

Returns

any

Example

import { eq } from "@tanstack/db"

collection.subscribeChanges(callback, {
  where: (row) => eq(row.status, "active")
})

Inherited from

Omit.where

whereExpression?

optional whereExpression: BasicExpression<boolean>;

Defined in: packages/db/src/types.ts:805

Pre-compiled expression for filtering changes

Inherited from

SubscribeChangesOptions.whereExpression