We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 31410ef commit 08c32feCopy full SHA for 08c32fe
js/src/output.ts
@@ -103,6 +103,14 @@ class IPyWidgetOutput extends Shiny.OutputBinding {
103
const view = await manager.create_view(model, {});
104
await manager.display_view(view, {el: el});
105
106
+ // Don't allow more than one .lmWidget container, which can happen
107
+ // when the view is displayed more than once
108
+ // N.B. It's probably better to get view(s) from m.views and .remove() them,
109
+ // but empirically, this seems to work better
110
+ while (el.childNodes.length > 1) {
111
+ el.removeChild(el.childNodes[0]);
112
+ }
113
+
114
// The ipywidgets container (.lmWidget)
115
const lmWidget = el.children[0] as HTMLElement;
116
0 commit comments