From 0d5c7cb9b0fce3de8a4761743c0519f5e14306a0 Mon Sep 17 00:00:00 2001 From: Richard Fogaca Nienkotter <63572350+richardfogaca@users.noreply.github.com> Date: Fri, 10 Apr 2026 14:36:44 -0300 Subject: [PATCH] fix(echarts): prevent tooltip crash during dashboard auto-refresh (#39277) Co-authored-by: Claude Opus 4.6 (1M context) (cherry picked from commit e9911fbac4a053ee23d7c94da968cba6b812b5f7) --- .../plugin-chart-echarts/src/components/Echart.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.tsx index e531db67eff..95e31481264 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.tsx @@ -277,12 +277,24 @@ function Echart( chartRef.current?.setOption(themedEchartOptions, { notMerge, replaceMerge: notMerge ? undefined : ['series'], - lazyUpdate: isDashboardRefreshing, + // lazyUpdate defers render, causing tooltip crashes on stale shapes (#39247) + lazyUpdate: false, }); } // eslint-disable-next-line react-hooks/exhaustive-deps -- isDashboardRefreshing intentionally excluded to prevent extra setOption calls }, [didMount, echartOptions, eventHandlers, zrEventHandlers, theme, vizType]); + // Clear tooltip on refresh start to avoid stale content (#39247) + useEffect(() => { + if (didMount && isDashboardRefreshing && chartRef.current) { + chartRef.current.dispatchAction({ type: 'hideTip' }); + chartRef.current.dispatchAction({ + type: 'updateAxisPointer', + currTrigger: 'leave', + }); + } + }, [didMount, isDashboardRefreshing]); + useEffect(() => () => chartRef.current?.dispose(), []); // highlighting