For anyone looking for solution for offline, I jus...
# supabase-kt
d
For anyone looking for solution for offline, I just open-sourced supabase-offline-kt. it's an offline-first plugin for supabase-kt. So far it does cached reads, queued writes replayed in order, and cached Storage files. Android + iOS from Kotlin Multiplatform, plus a Swift package. Looking for any and all feedback! There's a sample todo app in the repo that tries to demonstrate the public API surface area https://github.com/nesfeder/supabase-offline-kt
s
Not having the time to read through the code for this: In your todo, how do you wire pending uploads to your read cache? Or do you also need to query the pending upload queue? Having written a full sqlite -> supabase -> sqlite flow, I'm wondering if this could simplify it.
d
Reads check the queue every time. I don't write anything into the cache ahead of time. The cache just stores the server's response for each query. When you read, it takes that cached response and applies your pending writes on top: inserts get added, updates get patched, deletes get removed. When a write syncs, it stays applied until that list gets refetched from the server, and then it drops out. So there's no writing optimistic rows into local tables, and no reconcile step afterward. The trade-off is there's no local SQL. Pending rows only match simple filters (eq, neq, in, is), and they don't respect sort order or limits.