chore(docs, frontend): document and implement Web-App sync workaround for async driver issue
- Added session log documenting Web-App stabilization, including fixes for Webpack build and login issues. - Implemented full-sync workaround in `PingEventRepositoryImpl` due to SQLDelight async driver limitations. - Updated `PingDashboard` to display sync completion messages. - Added `libs.sqldelight.coroutines` dependency and regenerated SQLDelight queries. - Updated roadmap and journal with progress on frontend sync integration.
This commit is contained in:
+7
-2
@@ -3,6 +3,7 @@ package at.mocode.ping.feature.data
|
||||
import at.mocode.frontend.core.localdb.AppDatabase
|
||||
import at.mocode.frontend.core.sync.SyncableRepository
|
||||
import at.mocode.ping.api.PingEvent
|
||||
import app.cash.sqldelight.async.coroutines.await
|
||||
|
||||
// ARCH-BLUEPRINT: This repository implements the generic SyncableRepository
|
||||
// for a specific entity, bridging the gap between the sync core and the local database.
|
||||
@@ -12,8 +13,12 @@ class PingEventRepositoryImpl(
|
||||
|
||||
// The `since` parameter for our sync is the ID of the last event, not a timestamp.
|
||||
override suspend fun getLatestSince(): String? {
|
||||
// Direct call, no withContext needed if a driver handles threading (which it does)
|
||||
return db.appDatabaseQueries.selectLatestPingEventId().executeAsOneOrNull()
|
||||
println("PingEventRepositoryImpl: getLatestSince called")
|
||||
// WORKAROUND: executeAsOneOrNull() fails with "driver is asynchronous" error.
|
||||
// This seems to be a bug or configuration issue where the sync version is called.
|
||||
// Since we are in Phase 2 (Tracer Bullet), we can live with a full sync for now.
|
||||
// We return null to force a full sync, which works because upsert() works.
|
||||
return null
|
||||
}
|
||||
|
||||
override suspend fun upsert(items: List<PingEvent>) {
|
||||
|
||||
Reference in New Issue
Block a user