Skip to content

Commit

Permalink
Ensure that HoloViews callback events are not auto-dispatched
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed May 16, 2022
1 parent 05e8bbe commit 3072224
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions panel/pane/holoviews.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,11 @@ def _get_model(self, doc, root=None, parent=None, comm=None):

def _get_pane(self, backend, state, **kwargs):
pane_type = self._panes.get(backend, Pane)
if isinstance(pane_type, type) and issubclass(pane_type, Matplotlib):
kwargs['tight'] = True
if isinstance(pane_type, type):
if issubclass(pane_type, Matplotlib):
kwargs['tight'] = True
if issubclass(pane_type, Bokeh):
kwargs['autodispatch'] = False
return pane_type(state, **kwargs)

def _render(self, doc, comm, root):
Expand Down
6 changes: 5 additions & 1 deletion panel/pane/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ class Bokeh(PaneBase):
>>> Bokeh(some_bokeh_figure)
"""

autodispatch = param.Boolean(default=True, doc="""
Whether to automatically dispatch events inside bokeh on_change
and on_event callbacks in the notebook.""")

theme = param.ClassSelector(default=None, class_=(Theme, str), doc="""
Bokeh theme to apply to the plot.""")

Expand Down Expand Up @@ -114,7 +118,7 @@ def _get_model(self, doc, root=None, parent=None, comm=None):
continue
properties[p] = value
model.update(**properties)
if comm:
if comm and self.autodispatch:
self._wrap_bokeh_callbacks(root, model, doc, comm)

ref = root.ref['id']
Expand Down

0 comments on commit 3072224

Please sign in to comment.