Hallo,
I am using queryChangeFlow() on my Query to keep the documents updated inside a RecyclerView. When documents get updated/deleted and pulled to the device, everything works fine. But when removing the channel of a document, the replicator gets the document with an “ACCESS_REMOVED” flag and purges it from the lite database. But the queryChangeFlow() does not trigger on the removed document change.
Only on a new call of the Flow function (getPublicConsumptionListFlow) the documents results are refrehed correctly.
I thing it is a bug of the Couchbase queryChangeFlow() Function?
Is it somehow possible to refresh the flow when receiving the document over the documentReplicatorFlow?
Query Flow:
override fun getPublicConsumptionListFlow(): Flow<List<ConsumptionModelDTO>> {
val db = databaseManager.getConsumptionDatabase()
val query = db?.let { DataSource.database(it) }?.let {
QueryBuilder.select(
SelectResult.expression(Meta.id),
SelectResult.all())
.from(it.`as`("item"))
.where(Expression.property("type").equalTo(Expression.string("consumption")))
}
val flow = query!!
.queryChangeFlow()
.map { qc -> mapQueryChangeToConsumptionList(qc) }
.flowOn(Dispatchers.IO)
query.execute()
return flow
}
Replicator Config:
replicator =
Replicator(
ReplicatorConfigurationFactory.create(
database = evDatabase,
target = URLEndpoint(url!!),
type = ReplicatorType.PUSH_AND_PULL,
continuous = true,
authenticator = SessionAuthenticator(session),
enableAutoPurge = true
)
)