You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it should use the localTasks instead of converting the network tasks to local again, otherwise the withContext() has no purpose:
suspendfunrefresh() {
val networkTasks = networkDataSource.loadTasks()
localDataSource.deleteAll()
val localTasks = withContext(dispatcher) {
networkTasks.toLocal()
}
localDataSource.upsertAll(localTasks) // Fixed this line
}
Here:
suspend fun refresh() { val networkTasks = networkDataSource.loadTasks() localDataSource.deleteAll() val localTasks = withContext(dispatcher) { networkTasks.toLocal() } localDataSource.upsertAll(networkTasks.toLocal()) }
The last line should probably read:
localDataSource.upsertAll(networkTasks.toLocal())
The text was updated successfully, but these errors were encountered: