Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Commit 80fb8bb

Browse files
Merge pull request #86 from plotly/fix-parent
fix infer_jupyter_proxy_config again for new jupyterlab
2 parents da91751 + 9c6e668 commit 80fb8bb

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

‎jupyter_dash/comms.py‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,27 @@
99

1010
_dash_comm = Comm(target_name='jupyter_dash')
1111

12+
_caller = {}
13+
1214

1315
def _send_jupyter_config_comm_request():
1416
# If running in an ipython kernel,
1517
# request that the front end extension send us the notebook server base URL
1618
if IPython.get_ipython() is not None:
1719
if _dash_comm.kernel is not None:
20+
_caller["parent"] = _dash_comm.kernel.get_parent()
1821
_dash_comm.send({
1922
'type': 'base_url_request'
2023
})
2124

2225

2326
@_dash_comm.on_msg
2427
def _receive_message(msg):
28+
prev_parent = _caller.get("parent")
29+
if prev_parent and prev_parent != _dash_comm.kernel.get_parent():
30+
_dash_comm.kernel.set_parent([prev_parent["header"]["session"]], prev_parent)
31+
del _caller["parent"]
32+
2533
msg_data = msg.get('content').get('data')
2634
msg_type = msg_data.get('type', None)
2735
if msg_type == 'base_url_response':
@@ -69,8 +77,8 @@ def capture_event(stream, ident, parent):
6977
break
7078

7179
if asyncio.iscoroutinefunction(kernel.do_one_iteration):
72-
nest_asyncio.apply()
7380
loop = asyncio.get_event_loop()
81+
nest_asyncio.apply(loop)
7482
loop.run_until_complete(kernel.do_one_iteration())
7583
else:
7684
kernel.do_one_iteration()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /