Skip to content

Commit

Permalink
Ensure Plotly pane renders and hides correctly in Card (#6468)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored Mar 11, 2024
1 parent d26e94a commit 7ebde29
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions panel/models/plotly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ export class PlotlyPlotView extends HTMLBoxView {
}

override remove(): void {
(window as any).Plotly.purge(this.container)
if (this.container != null) {
(window as any).Plotly.purge(this.container)
}
super.remove()
}

Expand All @@ -196,14 +198,14 @@ export class PlotlyPlotView extends HTMLBoxView {
}

override style_redraw(): void {
if (this._rendered) {
if (this._rendered && this.container != null) {
(window as any).Plotly.Plots.resize(this.container)
}
}

override after_layout(): void {
super.after_layout()
if (this._rendered) {
if (this._rendered && this.container != null) {
(window as any).Plotly.Plots.resize(this.container)
}
}
Expand Down

0 comments on commit 7ebde29

Please sign in to comment.