diff --git a/jdaviz/core/template_mixin.py b/jdaviz/core/template_mixin.py index 97d87371cc..b293b18b36 100644 --- a/jdaviz/core/template_mixin.py +++ b/jdaviz/core/template_mixin.py @@ -4401,25 +4401,17 @@ def is_mixed(self, glue_values): return len(np.unique(glue_values, axis=0)) > 1 def _update_mixed_state(self): - if len(self.linked_states) <= 1: - mixed = False - else: + if self._processing_change_from_glue: + return + + if len(self.linked_states) >= 1: current_glue_values = [] for state in self.linked_states: current_glue_values.append(self._get_glue_value(state)) - mixed = self.is_mixed(current_glue_values) - # ensure the value corresponds to the first entry, this prevents the case where a glue - # change to one of the linked_states changes the value that will be adopted when - # unmixing something in mixed state and results in more consistent and predictable - # behavior - self._processing_change_from_glue = True - first_value = current_glue_values[0] - if isinstance(first_value, np.float32): - first_value = first_value.astype(np.float64) - self.value = first_value - self._processing_change_from_glue = False - self.sync = {**self.sync, - 'mixed': mixed} + + if len(current_glue_values) and current_glue_values[0] is not None: + # sync the initial value of the widget, avoiding recursion + self._on_glue_value_changed(current_glue_values[0]) def _on_value_changed(self, msg): if self._processing_change_from_glue: