Database queries function without network connectivity
Why it matters
When every data query requires a live network round-trip, users on flaky connections — subways, elevators, rural areas — get a blank or broken screen. Mobile network reliability is not a product assumption; it is a variable you must handle. ISO 25010:2011 reliability.fault-tolerance and recoverability both penalize apps that have no local query path. Beyond connectivity, local queries are also faster by orders of magnitude: a SQLite SELECT takes microseconds; a network call takes hundreds of milliseconds even on good connections. An offline query layer is the foundation for every other pattern in this bundle.
Severity rationale
Critical because apps with no offline query capability become completely unusable without network access, blocking users from data they already have on-device.
Remediation
Add a local database layer using expo-sqlite or WatermelonDB, then route at least one primary data-loading function through it before hitting the network.
// npm install expo-sqlite
import * as SQLite from 'expo-sqlite';
const db = SQLite.openDatabase('app.db');
export const initDB = () =>
new Promise<void>((resolve, reject) =>
db.transaction(tx =>
tx.executeSql(
'CREATE TABLE IF NOT EXISTS items (id TEXT PRIMARY KEY, data TEXT, updated_at INTEGER);',
[],
() => resolve(),
(_, err) => { reject(err); return false; }
)
)
);
export const queryItems = (): Promise<unknown[]> =>
new Promise((resolve, reject) =>
db.transaction(tx =>
tx.executeSql(
'SELECT * FROM items ORDER BY updated_at DESC;',
[],
(_, result) => resolve(result.rows._array),
(_, err) => { reject(err); return false; }
)
)
);
On first launch, seed the local DB from the network. On subsequent launches, read from local first, then sync in the background via data-sync-on-reconnect.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Mobile Offline & Storage Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- iso-25010:2011 · reliability.recoverability — Recoverability
Taxons
History
- 2026-04-18·v1.0.0·Initial import from mobile-offline-storage·automated