https://kotlinlang.org logo
Title
m

Marc Knaup

04/20/2020, 3:53 PM
Is there something like
Flow.distinctUntilChangedOrCollected()
or a simple way to implement it? Basically a value in the
Flow
should be ignored if a) it’s equal to the previous value and b) the previous value hasn’t been collected downstream yet (due to
mapLatest
being slow). If I only use
distinctUntilChanged()
then the second value would obviously be ignored independent of b).
z

Zach Klippenstein (he/him) [MOD]

04/20/2020, 4:33 PM
Sounds like
distinctUntilChanged()
+
conflate()
?
m

Marc Knaup

04/20/2020, 5:42 PM
@streetsofboston that does not help 😅 @Zach Klippenstein (he/him) [MOD] that wouldn’t work. As soon as
distinctUntilChanged()
is involved the second value would be lost as it’s not distinct to the previous one. I basically need
distinctUntilChanged()
forget about the previous value once it has been collected downstream. Or maybe find a way where some upstream part of the Flow can be reset downstream 🤔
s

streetsofboston

04/20/2020, 5:43 PM
Sorry, Marc. I didn’t read much further than your first sentence on my phone 🙂 Point b) is not addressed in my ‘answer’ 🙂
😄 1