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
When we have complex compound hierarchy with relation to a list of entities (or compounds) - reactive subscription via flow doesn't emit new values on changed entities.
Environment: kabin: 0.1.0-alpha05; android target.
SQLite version (according to documentation): 3.39 (API 34).
Example
data classCompound1(
valentity:Entity1,
@Relation(
entity =Entity2::class,
parentColumn ="id",
entityColumn ="id"
)
valcompounds2:List<Compound2>
)
@Dao
interfaceIEntity2Dao {
@Query("DELETE FROM Entity2 WHERE id = :id")
suspendfunremoveEntity(id:String)
}
@Dao
interfaceIEntity1Dao {
@Query("SELECT * FROM Entity1")
suspendfungetCompound(id:String): Flow<Compound1>
}
to reproduce:
suspendfunreproducer(
dao1:IEntity1Dao,
dao2:IEntity2Dao
) {
coroutineScope.launch {
dao1.getCompound("id1").collect {
// only first emit
}
dao2.removeEntity("id2")
}
}
The text was updated successfully, but these errors were encountered:
The problem is that getCompound relies on queryEntity1 under the hood, which queries Entity1 without adding listeners on Compound2's entities.
We need to generate separate queries for compound entities, such as queryEntity1ForCompound1, which does register all child entities as listenable keys.
As I mentioned earlier, some changes have to be made with the naming to distinguish simple entity queries, and queries meant for compounds. The naming now looks like this:
A simple entity query for Entity1 will be queryEntity1ByParameters
A query for Entity1 that's inside Compound1 will be queryEntity1ForCompound1ByParameters
Problem
When we have complex compound hierarchy with relation to a list of entities (or compounds) - reactive subscription via flow doesn't emit new values on changed entities.
Environment: kabin: 0.1.0-alpha05; android target.
SQLite version (according to documentation): 3.39 (API 34).
Example
to reproduce:
The text was updated successfully, but these errors were encountered: