Skip to content

Commit

Permalink
Patch HoloViews client comm to ensure server comm is initialized (#6234)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored Jan 18, 2024
1 parent 156cd24 commit 00a45d7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ This patch release focuses on a number of fixes and minor enhancements for the c
- Fix pyodide loading message styling issues ([#6194](https://github.com/holoviz/panel/pull/6194))
- More complete patch for the `TextEditor` to support being rendered in the Shadow DOM ([#6222](https://github.com/holoviz/panel/pull/6222))
- Add guard to `Tabulator` ensuring that it does not error when it is not rendered ([#6223](https://github.com/holoviz/panel/pull/6223))
- Fix race conditions when instantiating Comm in Jupyter causing notifications to break ([#6229](https://github.com/holoviz/panel/pull/6229))
- Fix race conditions when instantiating Comm in Jupyter causing notifications to break ([#6229](https://github.com/holoviz/panel/pull/6229), [#6234](https://github.com/holoviz/panel/pull/6234))
- Handle duplicate attempts at refreshing auth tokens ([#6233](https://github.com/holoviz/panel/pull/6233))

### Compatibility & Security

Expand Down
3 changes: 2 additions & 1 deletion doc/about/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ This patch release focuses on a number of fixes and minor enhancements for the c
- Fix pyodide loading message styling issues ([#6194](https://github.com/holoviz/panel/pull/6194))
- More complete patch for the `TextEditor` to support being rendered in the Shadow DOM ([#6222](https://github.com/holoviz/panel/pull/6222))
- Add guard to `Tabulator` ensuring that it does not error when it is not rendered ([#6223](https://github.com/holoviz/panel/pull/6223))
- Fix race conditions when instantiating Comm in Jupyter causing notifications to break ([#6229](https://github.com/holoviz/panel/pull/6229))
- Fix race conditions when instantiating Comm in Jupyter causing notifications to break ([#6229](https://github.com/holoviz/panel/pull/6229), [#6234](https://github.com/holoviz/panel/pull/6234))
- Handle duplicate attempts at refreshing auth tokens ([#6233](https://github.com/holoviz/panel/pull/6233))

### Compatibility & Security

Expand Down
7 changes: 7 additions & 0 deletions panel/io/notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,13 @@ def render_mimebundle(
Displays bokeh output inside a notebook using the PyViz display
and comms machinery.
"""
# WARNING: Patches the client comm created by some external library
# e.g. HoloViews, with an on_open handler that will initialize
# the server comm.
if manager and manager.client_comm_id in _JupyterCommManager._comms:
client_comm = _JupyterCommManager._comms[manager.client_comm_id]
if not client_comm._on_open:
client_comm._on_open = lambda _: comm.init()
if not isinstance(model, Model):
raise ValueError('Can only render bokeh LayoutDOM models')
add_to_doc(model, doc, True)
Expand Down

0 comments on commit 00a45d7

Please sign in to comment.