Skip to content
Source
Sign inSign up
TanStack/db

fix(react-native): decode op-sqlite results losslessly #1848

MergedKyleAMathews(GitHub profile, opens in a new tab)merged 20 commits intomain fromrefs/pull/1848/headmerged by KyleAMathews(GitHub profile, opens in a new tab)

Showing 16 changed files with 126 additions and 8 deletions (loading 13).

x
0 of 16 viewed, 16 left
6 additions and 0 deletions.changeset/fix-op-sqlite-result-decoding.mdAdded
View file
@@ -0,0 +1,6 @@
+---
+'@tanstack/react-native-db-sqlite-persistence': patch
+---
+​
+Decode op-sqlite row arrays and columnar results losslessly, and reject malformed or unknown result envelopes instead of treating them as empty results.
+Custom wrappers that return a genuinely ambiguous bare array can set `arrayResultMode` to `rows` or `statement-results`; without that authoritative mode, the driver rejects instead of silently reshaping data.
114 additions and 8 deletionspackages/db-sqlite-persistence-core/tests/contracts/sqlite-driver-contract.tsModified
View file
@@ -30,11 +30,36 @@
fn: (harness: SQLiteDriverContractHarness) => Promise<T>,
): Promise<T> {
const harness = createHarness()
+ let outcome: { ok: true; value: T } | { ok: false; error: unknown }
try {
- return await fn(harness)
- } finally {
- await Promise.resolve(harness.cleanup())
+ outcome = { ok: true, value: await fn(harness) }
+ } catch (error) {
+ outcome = { ok: false, error }
+​
+ let cleanupOutcome: { ok: true } | { ok: false; error: unknown } = {
+ ok: true,