mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) Fix js errors when (un)summarizing underlying table of charts
Summary: Used to throw js errors: `Resize must be passed a displayed plot div element.` Summarizing (or unsummarizing) causes the ChartView view instance to be replace by a new one in the view layout. However, the problem is that the old view instance get disposed only after the new view instance is added to the view layout. This causes the old view layout to try to resize chart while chart dom has been removed from the dom (which Plotly does not support). This diff fixes it by checking the the chart dom elemnt is still in the dom before making the plotly call to resize the chart. TODO: It feels weird that the old view instance gets disposed after the new one get added. Maybe we should check that also. Test Plan: New test added. Reviewers: dsagal Reviewed By: dsagal Subscribers: dsagal Differential Revision: https://phab.getgrist.com/D3035
This commit is contained in:
parent
a974dd839c
commit
33f056a187
@ -206,7 +206,7 @@ export class ChartView extends Disposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _resizeChart() {
|
private _resizeChart() {
|
||||||
if (this.isDisposed() || !Plotly) { return; }
|
if (this.isDisposed() || !Plotly || !this._chartDom.parentNode) { return; }
|
||||||
Plotly.Plots.resize(this._chartDom);
|
Plotly.Plots.resize(this._chartDom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user