fix(echarts): prevent tooltip crash during dashboard auto-refresh (#39277)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Richard Fogaca Nienkotter
2026-04-10 14:36:44 -03:00
committed by GitHub
parent 69c8eef78e
commit e9911fbac4

View File

@@ -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