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

nuhkoca

06/28/2022, 3:18 PM
Hello, how do I treat every new parameter as not equal with the previous one even if the instance is the same? I have a pulse component and for testing I just send consecutive
Up
objects but it just reflects the first one not others(see the first row). I set
neverEqualPolicy
but it doesn’t work, tho. What is your take for such cases? Thanks!
Copy code
val state = remember { mutableStateOf(initial, neverEqualPolicy()) }
Copy code
sealed class PerformancePulseUpdate : Serializable {
    object Up : PerformancePulseUpdate()
    object Down : PerformancePulseUpdate()
    object None : PerformancePulseUpdate()
}
z

Zach Klippenstein (he/him) [MOD]

06/29/2022, 3:37 AM
Need to see more code to troubleshoot, but this just looks like an antipattern. Your update objects are events by definition—an update is something is “happens”, not something that “is”—so you're going to be swimming upstream all the way if you try to treat them as state.
n

nuhkoca

06/29/2022, 7:31 AM
Hello, thank you! Created a gist for you including all classes https://gist.github.com/nuhkoca/ede72676aeb47960a5990ebbfdaea381
3 Views