[Bug] TypeError in getDataParams when getData() returns null on disposed series
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 42/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- typescript
- Lĩnh vực
- data-visualization
Hướng nghiên cứu
Bắt đầu bằng cách đọc DataFormatMixin.getDataParams() trong dataFormat.ts và các phiên bản override của getDataParams() trong TreemapSeries.ts, SunburstSeries.ts, TreeSeries.ts, PieSeries.ts, FunnelSeries.ts và ChordSeries.ts. Theo dõi đường đi của sự kiện từ echarts.ts:778 và các bên gọi trong TooltipView.ts:385, 458, rồi tái hiện việc giải phóng trong quá trình tương tác. Hoàn thành nghĩa là các sự kiện chuột cũ trên các loại biểu đồ được liệt kê bị bỏ qua mà không có TypeErrors.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version
6.0.0 (bug present since at least 4.1.0)
Link to Minimal Reproduction
N/A — occurs in any framework (React, Vue, Angular) where chart components unmount during user interaction.
Steps to Reproduce
- Render any chart (sankey, treemap, pie, line) with mouse event handlers
- Navigate away (unmount the component) or call
setOptionwith replacement data while the mouse cursor is over the chart - A stale
mousemove/mouseoutevent fires afterdispose()clears the series data
Current Behavior
TypeError crashes:
Cannot read properties of undefined (reading 'getRawIndex')— fromDataFormatMixin.getDataParams()base methodCannot read properties of undefined (reading 'tree')— fromTreemapSeriesModel.getDataParams()override- Similar crashes possible in pie (
.each), funnel (.mapDimension), sunburst/tree (.tree), chord (.getName)
Stack trace (Sankey example):
DataFormatMixin.getDataParams (dataFormat.ts)
SankeySeriesModel.getDataParams (SankeySeries.ts)
<anonymous> (echarts.ts:778) — findEventDispatcher callback
ECharts.handler → Handler.mousemove → HandlerDomProxy.mousemove
Stack trace (Treemap example):
TreemapSeriesModel.getDataParams (TreemapSeries.ts:126)
<anonymous> (echarts.ts:778)
findEventDispatcher → ECharts.handler → Handler.mousemove
Expected Behavior
Mouse events on disposed chart elements should be silently ignored, not throw TypeErrors.
Root Cause
SeriesModel.getData() can return null/undefined when a series is not alive. The comment in Series.ts explicitly acknowledges this:
// When series is not alive (that may happen when click toolbox
// restore or setOption with not merge mode), series data may
// be still need to judge animation or something when graphic
// elements want to know whether fade out.
return inner(this).data; // ← can be undefined
But getDataParams() and its 6 chart-specific overrides unconditionally access properties on the result. The event handler at echarts.ts calls getDataParams() on mouse events, which can fire on stale DOM elements after the series is disposed.
13+ vulnerable call sites identified:
dataFormat.ts— basegetDataParams()callsdata.getRawIndex(),data.getName(), etc.echarts.ts:778— event handler callsgetDataParams()on potentially dead seriesTreemapSeries.ts,SunburstSeries.ts,TreeSeries.ts— override accessesdata.treePieSeries.ts— override accessesdata.each(),data.mapDimension()FunnelSeries.ts— override accessesdata.mapDimension(),data.getSum()ChordSeries.ts— override accessesdata.getName(),this.getGraph()TooltipView.ts:385, 458— unguarded callers
Affects all chart types and all frameworks where component lifecycle causes chart disposal during user interaction.
Related Issues
- #9402 — Original report (pie chart, closed 2018 as "cannot-reproduce" but never fixed)
- #16998 — Same error on stacked line chart (open)
Environment
- OS: macOS (also reproducible on Linux/Windows)
- Browser: Chrome, Firefox, Safari
- Framework: React 19 + Next.js 16 (but framework-agnostic)
- Ngôn ngữ chính
- TypeScript
- Star
- 67.7k
- Fork
- 19.9k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/echarts
-
[Bug] String formatter templates only replace the first occurrence of `{a}`/`{b}`/`{c}`Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởen pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
-
[Bug] Inverse axis collapses the grid with outerBoundsContain when a tick is near the axis edgeCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởen pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
en pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
en pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
[Bug] The zoom cursor in the toolbox area is incorrectCó thể đã có người làm @waterWang đã nhận 98 ngày trước. Đang mởbug en pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Tất cả issue của apache/echarts
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
pollen-robotics/reachy-mini-desktop-app#341 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
mike-north/AgentMonitors#648 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Position: a popup placed again from between two layout steps lands a fraction of a pixel offĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
vercel-labs/ui#700 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 2 ngày