File tree 3 files changed +13
-1
lines changed
3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ All notable changes to shinywidgets will be documented in this file.
5
5
The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
6
6
and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
7
7
8
+ ## [ UNRELEASED]
9
+
10
+ * Eliminate the possibility of a single ` @render_widget ` output from keeping a view of prior renders. (#196 )
11
+
8
12
## [ 0.6.1] - 2025-05-21
9
13
10
14
* Fixed an issue introduced by v0.6.0 where cleanup wasn't happening when it should be. (#195 )
Original file line number Diff line number Diff line change @@ -103,6 +103,14 @@ class IPyWidgetOutput extends Shiny.OutputBinding {
103
103
const view = await manager . create_view ( model , { } ) ;
104
104
await manager . display_view ( view , { el : el } ) ;
105
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
+
106
114
// The ipywidgets container (.lmWidget)
107
115
const lmWidget = el . children [ 0 ] as HTMLElement ;
108
116
You can’t perform that action at this time.
0 commit comments