fix(releaseBubbles): guard echarts mouse handlers against disposed instance#119460
Draft
billyvg wants to merge 1 commit into
Draft
fix(releaseBubbles): guard echarts mouse handlers against disposed instance#119460billyvg wants to merge 1 commit into
billyvg wants to merge 1 commit into
Conversation
Adds isDisposed() checks to all mouse/legend event handlers in useReleaseBubbles so that they bail out if the echarts instance has been disposed before the event fires. Fixes the crash where echartsInstance.setOption() is called during a chart state transition (e.g. dep-driven re-render) after the model has been torn down, causing MarkerModel._mergeOption to iterate a stale _seriesIndices array and hit undefined seriesModel. Fixes JAVASCRIPT-3AP8 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RgKuwi8ia6932f3JRJau9x
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a
TypeError: Cannot read properties of undefined (reading 'get')crash inuseReleaseBubbles.tsxthat is escalating in production (Sentry issue JAVASCRIPT-3AP8, 290 events, 193 users affected).Root cause
All five echarts event handlers in
handleChartRef(handleMouseMove,handleMouseOver,handleMouseOut,handleGlobalOut,handleLegendSelectChanged) checked!echartsInstancebut did not checkechartsInstance.isDisposed().The crash path is:
mousemoveDOM handler fires and internally dispatches amouseoutevent viaHandler.prototype.dispatchToElementhandleMouseOutcallbackhandleMouseOutcallsechartsInstance.setOption(...)— but at this point the chart is mid-teardown (deps changed, triggering cleanup + re-registration, or component is unmounting)GlobalModel._mergeOptioniterates_seriesIndicesand hits a stale/undefinedseriesModel, throwingTypeError: Cannot read properties of undefined (reading 'get')Fix
Add
echartsInstance.isDisposed()to the guard condition in all five handlers. ECharts sets this flag synchronously whendispose()is called, so the check is reliable.This is the approach recommended by Seer analysis on the issue.
Evidence
useReleaseBubbles.tsx:552insidehandleMouseOut → setOption → GlobalModel._mergeOption → eachSeries → seriesModel.getClaude session
https://claude.ai/code/session_01RgKuwi8ia6932f3JRJau9x
Generated by Claude Code