File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
commonIntegrationTest/kotlin/com/powersync
commonMain/kotlin/com/powersync Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change 11package com.powersync
22
3+ import app.cash.turbine.test
34import app.cash.turbine.turbineScope
45import co.touchlab.kermit.ExperimentalKermitApi
56import com.powersync.db.ActiveDatabaseGroup
@@ -441,6 +442,9 @@ class DatabaseTest {
441442 }
442443 }
443444
445+ // Before inserting data, the flow should be empty
446+ database.getCrudTransactions().test { awaitComplete() }
447+
444448 insertInTransaction(5 )
445449 insertInTransaction(10 )
446450 insertInTransaction(15 )
Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ public interface PowerSyncDatabase : Queries {
137137 public suspend fun getNextCrudTransaction (): CrudTransaction ? = getCrudTransactions().firstOrNull()
138138
139139 /* *
140- * Obtains a flow of transactions with local data against the database.
140+ * Obtains a flow emitting completed transactions with local writes against the database.
141141
142142 * This is typically used from the [PowerSyncBackendConnector.uploadData] callback.
143143 * Each entry emitted by the returned flow is a full transaction containing all local writes
@@ -154,7 +154,7 @@ public interface PowerSyncDatabase : Queries {
154154 * val batch = mutableListOf<CrudEntry>()
155155 * var lastTx: CrudTransaction? = null
156156 *
157- * database.getCrudTransactions().takeWhile { batch.size < 10 }.collect {
157+ * database.getCrudTransactions().takeWhile { batch.size < 100 }.collect {
158158 * batch.addAll(it.crud)
159159 * lastTx = it
160160 * }
You can’t perform that action at this time.
0 commit comments