https://kotlinlang.org logo
#compose
Title
# compose
n

Ngọc Nguyên Nguyễn

06/24/2022, 7:36 AM
Hello every one!!, I have a useCase return flow of list<item>, I want to emit this data two times from one useCase. Return data is correct but my lazy column just recompose 1 time, and the next data is update after scroll… Code in thread:
s

Stylianos Gakis

06/24/2022, 8:08 AM
First, your function doesn’t have to be suspending since you’re returning a flow directly, and you’re in a suspending context inside the flow {} block. Is
data
a data class? Could you use .copy on it instead of .apply to make changes to one of the fields? As I see it,
items
inside of it is a
var
, since you’re re-assigning it a new value. Then when doing emit(), since you may be emitting the same data object, compose may not be picking up on the new value since it considers it to be the same item. Could you either show how CommentItems looks like to make this easier, or at least make everything a val in there to see what that does.
🙌 1
n

Ngọc Nguyên Nguyễn

06/24/2022, 8:34 AM
Tks for answer, I will try
3 Views