feat(examples): add wa-sqlite OPFS persistence demo#1329
feat(examples): add wa-sqlite OPFS persistence demo#1329
Conversation
|
More templates
@tanstack/angular-db
@tanstack/db
@tanstack/db-browser-wa-sqlite-persisted-collection
@tanstack/db-ivm
@tanstack/db-react-native-sqlite-persisted-collection
@tanstack/db-sqlite-persisted-collection-core
@tanstack/electric-db-collection
@tanstack/offline-transactions
@tanstack/powersync-db-collection
@tanstack/query-db-collection
@tanstack/react-db
@tanstack/rxdb-db-collection
@tanstack/solid-db
@tanstack/svelte-db
@tanstack/trailbase-db-collection
@tanstack/vue-db
commit: |
|
Size Change: 0 B Total Size: 110 kB ℹ️ View Unchanged
|
|
Size Change: 0 B Total Size: 4.23 kB ℹ️ View Unchanged
|
490d519 to
d7a150d
Compare
The infinite retry loop here might be related to #1065 |
37c3bf5 to
ca46819
Compare
dc17281 to
2841627
Compare
…ctions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2455641 to
e22631a
Compare
|
GPT5.4 review: Findings
resolve: {
alias: {
// Resolve to source so Vite can process the ?worker import natively
'@tanstack/db-browser-wa-sqlite-persisted-collection': path.resolve(
__dirname,
`../../../packages/db-browser-wa-sqlite-persisted-collection/src/index.ts`,
),
},
},export { createBrowserWASQLitePersistence } from './browser-persistence'
export { openBrowserWASQLiteOPFSDatabase } from './opfs-database'
export { BrowserCollectionCoordinator } from './browser-coordinator'
export type { BrowserCollectionCoordinatorOptions } from './browser-coordinator'
export { persistedCollectionOptions } from '@tanstack/db-sqlite-persisted-collection-core'AssumptionsThe PR body for #1329 already has “Replace the workspace dependencies...” unchecked, so this may be known. I’m still calling it out because it is a real blocker today, not just cleanup. Residual RiskI didn’t count the existing SPA/API example breakage against this PR since the author already called that out and it predates these changes. I also didn’t do browser smoke testing after finding the build blocker. |
The browser wa-sqlite package source re-exports from the core package, so resolving from source requires both aliases for the build to succeed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@kevin-dp maybe for a different PR, but the current (including in |
Summary
/wa-sqliteroute to the offline-transactions example app demonstrating collection-level persistence using@tanstack/db-browser-wa-sqlite-persisted-collectionpersistedCollectionOptionsfor local-first data storage in a real SQLite database in the browser via OPFS.wasmrequests), source aliasing for?workerimports, and a fix for the missinggetRouterexportTest plan
pnpm devinexamples/react/offline-transactions@tanstack/dband@tanstack/db-browser-wa-sqlite-persisted-collectionNote: the IndexedDB and localStorage examples in this demo are actually broken (were already broken before this PR). The API routes at
/api/todoswon't work in SPA mode because there's no server to handle them. ThefetchWithRetrykeeps retrying with exponential backoff, causing an infinite "Loading todos..." state.🤖 Generated with Claude Code