I'm trying to make three sliders synchronously update each other's values. However, the problem is that they trigger a loop when I slide one of them slowly.
here is the code:
slider_ids <- c("slider_1", "slider_2", "slider_3")
update_sliders <- function(changed_slider) {
new_value <- input[[changed_slider]]
other_sliders <- slider_ids[slider_ids != changed_slider]
lapply(other_sliders, function(slider_id) {
updateSliderInput(session, slider_id, value = new_value)
})
}
lapply(slider_ids, function(slider_id) {
observeEvent(input[[slider_id]], {
update_sliders(slider_id)
})
})