iex
02/25/2020, 4:03 PMprivate val dealerButtonTrigger: PublishSubject<Unit> = PublishSubject.create()
init {
dealerButtonTrigger.withLatestFrom(dealerAction.toObservable())
.subscribe { (_, action) ->
action.handle()
}
}
Here, when I click (i.e. call dealerButtonTrigger.onNext(Unit)
) after updating the dealer and navigating back, it still gives me the first dealer. Shouldn't it get the updated value?Zach Klippenstein (he/him) [MOD]
02/25/2020, 4:27 PMdealerAction
is a Single
â it only emits a single value. It doesnât have the concept of âupdated valueâ. If the value can change over time, it should be an Observable
, and the object backing dealerAction
should have some way of signaling that the value changed.Zach Klippenstein (he/him) [MOD]
02/25/2020, 4:28 PMtoObservable()
just changes the type, it doesnât magically add logic that knows how to detect when your data sources changes.Zach Klippenstein (he/him) [MOD]
02/25/2020, 4:30 PMZach Klippenstein (he/him) [MOD]
02/25/2020, 4:30 PMiex
02/25/2020, 4:52 PMtoObservable()
)iex
02/25/2020, 4:55 PMiex
02/25/2020, 4:55 PM