doubov
05/05/2022, 6:57 PMintents
were a Flow<Intent>:
intents.filterIsInstance<Intent.A>.flatMapLatest { intent -> repo.fetchModels(intent.input).map { data -> Msg.SetData(data) } }
Upon receiving Intent.A
we cancel the previously setup repo.fetchModels(...)
stream and restart it with the new input.
As far as I can see, this isn't really doable with the current implementation, unless I've missed something. Thanks in advance! 🙏Arkadii Ivanov
05/05/2022, 7:03 PMJob
returned by launch
. On new Intent, cancel the previous Job if any, then launch
and remember the new Job
.doubov
05/05/2022, 7:04 PM