I’m using a Slider to set a temperature and whose “value” property is bound to an RxJS Observable listening to a websocket.
This slider is used to set this same temperature: when the valueChange event is triggered, I send a request to the server to update the temperature and the server notifies the updated temperature on the websocket.
My problem is that setting the slider value programmatically (e.g. via the observable when the page is loaded, or when a new value is received via the websocket from another client) triggers the valueChange event, and the update request to the server, which is unnecessary obviously.
Is there a way to be notified of the valueChange event only on UI update, or to distinguish between programmatic and UI triggers?
The answer is probably no, so is there a clever way to manage that with some Rx magic?
Here are the observables I use:
temperature$: Observable<number>; // fed by the websocket sliderUpdate$: Observable<number>; // fed by valueChange event