update the slider when changing the state