Skip to content

Commit

Permalink
ensure LayerSelect updates
Browse files Browse the repository at this point in the history
* overly greedy, but ensures the layer items in the legend are updated for a new subset.
  • Loading branch information
kecnry committed Dec 6, 2024
1 parent 37dc6f4 commit bd16688
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions jdaviz/core/template_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1497,8 +1497,8 @@ def __init__(self, plugin, items, selected, viewer,
self.hub.subscribe(self, SubsetCreateMessage,
handler=lambda _: self._on_subset_created())
# will need SubsetUpdateMessage for name only (style shouldn't force a full refresh)
# self.hub.subscribe(self, SubsetUpdateMessage,
# handler=lambda _: self._update_layer_items())
self.hub.subscribe(self, SubsetUpdateMessage,
handler=lambda _: self._update_layer_items())
self.hub.subscribe(self, SubsetDeleteMessage,
handler=lambda _: self._update_layer_items())

Expand Down Expand Up @@ -1714,6 +1714,8 @@ def _on_data_added(self, msg=None):
@observe('filters', 'sort_by')
def _update_layer_items(self, msg={}):
# NOTE: _on_layers_changed is passed without a msg object during init
# TODO: if the message is a SubsetUpdateMessage, only act on those that require
# an update
# TODO: Handle changes to just one item without recompiling the whole thing
manual_items = [{'label': label} for label in self.manual_options]
# use getattr so the super() call above doesn't try to access the attr before
Expand Down

0 comments on commit bd16688

Please sign in to comment.