nizhalCollectionOptions
Copy page
import { nizhalCollectionOptions } from "@nizhal/db-collection";import { createCollection } from "@tanstack/react-db";
const notes = createCollection( nizhalCollectionOptions({ name: "notes", syncRule: "myNotes", echo, persistence: waSqlitePersistence({ /* driver */ }), }),);Returns a TanStack DB CollectionConfig whose SyncConfig.sync:
- Calls
echo.pullwith cursor + buckets forsyncRule - Applies
begin/write/commitfor each changed row - Handles
cursorResetby re-bootstrapping from cursor 0 - Maps sync-rule subset to
loadSubset/unloadSubset
name is the collection/table name. Row types should come from generated contract (nizhal gen) — not server Drizzle imports.
Lower-level
Section titled “Lower-level”buildNizhalSyncConfig and applyPullResult are exported for custom collection wiring.