From 1e7fe595192f67e57ef9e00fdd7a2de6c80919e8 Mon Sep 17 00:00:00 2001 From: karwosts <32912880+karwosts@users.noreply.github.com> Date: Tue, 14 Feb 2023 04:01:01 -0800 Subject: [PATCH] Add slight hysteresis to chart height to prevent scrollbar juddering (#15321) --- src/components/chart/ha-chart-base.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/chart/ha-chart-base.ts b/src/components/chart/ha-chart-base.ts index 0f7c5b9d3c..0235fcdf88 100644 --- a/src/components/chart/ha-chart-base.ts +++ b/src/components/chart/ha-chart-base.ts @@ -233,7 +233,11 @@ export default class HaChartBase extends LitElement { { id: "afterRenderHook", afterRender: (chart) => { - this._chartHeight = chart.height; + const change = chart.height - (this._chartHeight ?? 0); + if (!this._chartHeight || change > 0 || change < -12) { + // hysteresis to prevent infinite render loops + this._chartHeight = chart.height; + } }, legend: { ...this.options?.plugins?.legend,