https://kotlinlang.org logo
Title
g

gbaldeck

03/15/2021, 3:19 AM
is there any reason that a mutable state flow wouldnt cause a composable function to reload its state when the value of the state flow has changed? I'm running into an issue where I'm changing the value of a mutable state flow but the composable function that collects it as state is not receiving the update or doing a rerender
t

theapache64

03/15/2021, 4:32 AM
I think the composable won't update if
newValue == oldValue
. Are you sure that
newValue != oldValue
?
g

gbaldeck

03/15/2021, 4:39 AM
Yes I'm 100% sure it's different. Doing a .copy on the object. It might be because it's a data class though
If it does == on it. The equals method of the data class could be causing it
that was the issue, overrode equals with this === other and the issue has gone away
t

theapache64

03/15/2021, 6:54 AM
👍
v

Vahalaru

03/15/2021, 5:13 PM
That is just how kotlin works. Can be confusing.
😄 1
It seems this gentleman came up with a way to create a modal for State. Like a weird crossbreed step-child of fragment and recyclerview. When your dataset changes recyclerview calls updaterecyclerview. If you look down at the bottom the recompose function is a way to force rerender/update. I'm sure people way more creative than me can find some ingenious way to utilize that.