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

Ensure widgets using IPyWidget 8.0 get rendered #9524

Merged
merged 1 commit into from
Mar 29, 2022
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
1 change: 1 addition & 0 deletions news/1 Enhancements/8552.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ensure widgets using IPyWidgets 8.0 get rendered correctly.
7 changes: 5 additions & 2 deletions src/webviews/webview-side/ipywidgets/common/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,13 @@ export class WidgetManager implements IIPyWidgetManager, IMessageHandler {
// eslint-disable-next-line @typescript-eslint/no-require-imports
const jupyterLab = require('@jupyterlab/services') as typeof import('@jupyterlab/services'); // NOSONAR

if (!jupyterLab.KernelMessage.isDisplayDataMsg(payload)) {
if (
!jupyterLab.KernelMessage.isDisplayDataMsg(payload) &&
!jupyterLab.KernelMessage.isExecuteResultMsg(payload)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slight change in their widget protocol, now execute results contain the widget output for rendering

) {
return;
}
const displayMsg = payload as KernelMessage.IDisplayDataMsg;
const displayMsg = payload as KernelMessage.IDisplayDataMsg | KernelMessage.IExecuteResultMsg;

if (displayMsg.content && displayMsg.content.data && displayMsg.content.data[WIDGET_MIMETYPE]) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down