feat(expo-persistence): add official expo sqlite persistence adapter#1376
feat(expo-persistence): add official expo sqlite persistence adapter#1376
Conversation
|
aaf18a4 to
3bed14f
Compare
More templates
@tanstack/angular-db
@tanstack/db
@tanstack/db-browser-wa-sqlite-persisted-collection
@tanstack/db-expo-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
|
37c3bf5 to
ca46819
Compare
Add a dedicated expo-sqlite persistence package with real simulator/emulator smoke coverage so Expo apps can use the official SQLite runtime instead of the op-sqlite wrapper. Made-with: Cursor
d564126 to
75666ef
Compare
kevin-dp
left a comment
There was a problem hiding this comment.
PR Review: #1376 — feat(expo-persistence): add official expo sqlite persistence adapter
Overall
Good implementation. The driver makes a smart design choice by delegating transaction management to Expo's native withExclusiveTransactionAsync instead of manually issuing BEGIN/COMMIT/ROLLBACK — this is cleaner and lets the Expo SDK handle locking semantics. The persistence layer follows established patterns, and the test coverage is solid (persistence integration, runtime persistence contract, core adapter contract, plus bespoke driver tests). The env-driven test setup for swapping between better-sqlite3 and real emulator runtimes is well-designed.
Issues to address
-
package.json"files"includes"e2e"— This would publish the entire e2e directory (Expo runtime app, emulator harnesses, conformance suites) to npm. Other persistence packages only include["dist", "src"]. Remove"e2e"from the files array. -
Missing
expo-sqlite-driver-contract.test.ts— Every other persistence package runsrunSQLiteDriverContractSuiteagainst its driver. This PR has the core adapter contract and runtime persistence contract but not the driver contract. The bespoke driver tests cover the happy path well, but the shared driver contract suite validates edge cases around theSQLiteDriverinterface that are easy to miss. -
index.tsexportsExpoSQLiteDriver,createExpoSQLiteDriver, and internal types (ExpoSQLiteBindParams,ExpoSQLiteRunResult,ExpoSQLiteTransaction) — Other packages only export the persistence factory and core re-exports from their main entry, keeping the driver class in a sub-entry (e.g.,./capacitor,./tauri). This is a wider public API surface. Consider whether the driver class and its internal types should be part of the top-level public API, or gated behind a sub-entry.
Worth considering
expo-sqlitepeer dependency version^55.0.10— Expo SDK versions move fast. Worth confirming this is the minimum supported version and documenting whether it requires Expo SDK 53+ or similar.
Summary
Approve with changes — remove "e2e" from "files", add the driver contract test suite. The driver and persistence implementations are correct.
Summary
@tanstack/db-expo-sqlite-persisted-collectionpackage backed by the officialexpo-sqliteasync APIsop-sqlitewrapperTest plan
pnpm --filter @tanstack/db-expo-sqlite-persisted-collection test:e2e:expo:iospnpm --filter @tanstack/db-expo-sqlite-persisted-collection test:e2e:expo:androideslint --fixvia pre-commit)Made with Cursor