DB Docs
API Reference
- Core API Reference
- Collection
- createCollection
- liveQueryCollectionOptions
- createLiveQueryCollection
- createOptimisticAction
- createTransaction
- Electric DB Collection
- electricCollectionOptions
- Query DB Collection
- queryCollectionOptions
- RxDB DB Collection
- rxdbCollectionOptions
- PowerSync Collection
- powerSyncCollectionOptions
- createIndexedDB
- indexedDBCollectionOptions
- React Hooks
- useLiveQuery
AI/LLM: This documentation page is available in plain markdown format at/db/latest/docs/reference/powersync-db-collection/type-aliases/OnDemandSyncHooks.md
OnDemandSyncHooks
ts
type OnDemandSyncHooks = object;Defined in: definitions.ts:189
On-demand sync mode hooks. Called each time a subset is loaded or unloaded in response to live query changes.
Properties#
onLoad?#
ts
optional onLoad: never;Defined in: definitions.ts:191
onLoadSubset()?#
ts
optional onLoadSubset: (options) => CleanupFn | void | Promise<CleanupFn | void>;Defined in: definitions.ts:200
Called when a subset of data is requested by a live query. Use this to set up external data sources for the requested subset (e.g. subscribing to a sync stream with parameters derived from the query predicate).
Parameters#
options#
LoadSubsetOptions
Returns#
CleanupFn | void | Promise<CleanupFn | void>
A cleanup function that is called when the subset is unloaded.
syncMode#
ts
syncMode: "on-demand";Defined in: definitions.ts:190