Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix unmix state when changing value #3296

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion jdaviz/core/template_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4486,7 +4486,10 @@ def _on_glue_value_changed(self, value):
def unmix_state(self, new_value=None):
if new_value is None:
new_value = self.value
self._on_value_changed({'new': new_value})
if new_value != self.value:
self.value = new_value
else:
self._on_value_changed({'new': new_value})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If new_value == self.value, why is _on_value_changed needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to propagate to all the linked states (this happens when clicking to unmix the state, self.value is the nominal value (of the first linked state) and we want to propagate that to all other linked glue states)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(see the description above for the scenario where this makes a difference, probably could do the same by forcing a send_state, but that would then call _on_value_changed twice)

self.sync = {**self.sync,
'mixed': False}

Expand Down
Loading