Repository navigation
feat: add Convex collection with automatic pagination and durable offline writes - #2230
tannerlinsley wants to merge 4 commits into
Conversation
🦋 Changeset detectedLatest commit: 4f97ab4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Size Change: 0 B Total Size: 220 kB ℹ️ View Unchanged
|
More templates
@tanstack/angular-db
@tanstack/browser-db-sqlite-persistence
@tanstack/capacitor-db-sqlite-persistence
@tanstack/cloudflare-durable-objects-db-sqlite-persistence
@tanstack/convex-db-collection
@tanstack/db
@tanstack/db-ivm
@tanstack/db-sqlite-persistence-core
@tanstack/electric-db-collection
@tanstack/electron-db-sqlite-persistence
@tanstack/expo-db-sqlite-persistence
@tanstack/node-db-sqlite-persistence
@tanstack/offline-transactions
@tanstack/powersync-db-collection
@tanstack/query-db-collection
@tanstack/react-db
@tanstack/react-native-db-sqlite-persistence
@tanstack/react-router-with-db
@tanstack/rxdb-db-collection
@tanstack/solid-db
@tanstack/svelte-db
@tanstack/tauri-db-sqlite-persistence
@tanstack/trailbase-db-collection
@tanstack/vue-db
commit: |
|
I reviewed head Source acceptance is the blocking issue. The pagination API has a separate scalability question. I suggest describing the current API explicitly as a complete eager mirror and offering an on-demand option through DB’s existing The pagination oracle also needs stronger evidence:
The real-backend crash test reaches a valuable SIGKILL cut, but Finally, the snapshot oracle exercises raw arrays but not a successful I would address the source-acceptance failure before merge and make an explicit API decision about bounded eager use versus on-demand loading. |
🎯 Changes
Add
@tanstack/convex-db-collectionso TanStack DB can consume reactive Convex queries through either the JavaScript or React client. Includes typed query arguments, full-row synchronization, optimistic mutation handlers, and automatic pagination using public cursor boundaries and server split hints.Add durable offline mutation replay through the existing offline-transactions engine. An opt-in codec preserves Convex int64, special floats, binary values, and removed fields without changing the default outbox format. Applications supply an atomic, authenticated idempotency-key receipt in their server mutation.
Independent reviews found and fixed shared concrete-options ownership and repeated copying of incomplete pagination results. Direct collection construction now rejects reused options, separate DbClient materializations remain independent, and initial pagination copies rows only when the full result is ready.
🔬 Oracle Coverage
Owners and limits are recorded in
docs/contributing/oracle-coverage.md:Validation: 43 adapter checks, 302 offline-engine tests, seven real-backend tests, build, typecheck, lint, publint, and sherif. Production size against current main: new adapter 2,633 gzip / 2,381 brotli bytes with dependencies external; shared outbox +192 gzip / +174 brotli. Existing tree-shaken app scenarios are unchanged. The codec hook and ownership claim are required for native values and independent collection state; shared snapshot and outbox machinery avoid duplicate implementations.
Limits: bounded finite queries, one pending mutation per real-backend crash history, insert-only native payload variation in that backend witness. These tests do not establish cloud availability, filesystem power-loss atomicity, cross-collection publication, or backend multi-tab/batch replay.
✅ Checklist
🚀 Release Impact
Summary by CodeRabbit