Fix stale docs claiming web persistence is in-memory only
Web actually persists via localStorage (LocalStorageStores.kt), which survives page reloads — only SQLDelight itself isn't used there, since its web driver needs a worker plus a wasm sqlite binary. The doc comments and AGENTS.md still described the in-memory state this replaced. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FXcrACM5sok3M1KQJ8kByy
This commit is contained in:
@@ -10,8 +10,8 @@ import kotlin.time.Instant
|
||||
/**
|
||||
* Shared by every platform that opens a real [AppDatabase] (Android, Desktop, iOS/macOS) — only
|
||||
* driver construction differs per platform, so that's the only expect/actual boundary needed.
|
||||
* Web isn't a shipped platform (see README's Supported Platforms) and gets an in-memory fallback
|
||||
* instead of a real driver.
|
||||
* Web has no real SQLDelight driver and uses a `localStorage`-backed fallback instead (see
|
||||
* `LocalStorageStores.kt`).
|
||||
*/
|
||||
internal class SqlDelightExchangeRateStore(private val database: AppDatabase) : ExchangeRateStore {
|
||||
override suspend fun loadLastKnownRates(sourceId: String): ExchangeRates? = withContext(Dispatchers.Default) {
|
||||
|
||||
@@ -10,10 +10,11 @@ import xyz.tyiu.satsprice.data.ExchangeRates
|
||||
import kotlin.time.Instant
|
||||
|
||||
/**
|
||||
* Web isn't a shipped platform (see README's Supported Platforms) and SQLDelight's web driver
|
||||
* needs a worker plus a wasm sqlite binary, so persistence here goes through the browser's
|
||||
* localStorage instead of a real database — plenty for this small amount of data, and it
|
||||
* survives page reloads unlike the in-memory state it replaced.
|
||||
* SQLDelight's web driver needs a worker plus a wasm sqlite binary, so persistence here goes
|
||||
* through the browser's localStorage instead of a real database — plenty for this small amount
|
||||
* of data, and it survives page reloads like the other platforms' real databases do. Scoped to
|
||||
* the browser profile/origin, though: it won't survive a cleared site data / private window, and
|
||||
* doesn't sync or back up anywhere.
|
||||
*/
|
||||
private val json = Json { ignoreUnknownKeys = true }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user