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

Patch HoloViews client comm to ensure server comm is initialized #6234

Merged
merged 3 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
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
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