fix(heatmap): prevent crash with missing coordinate system#21698
Conversation
|
Thanks for your contribution! Please DO NOT commit the files in dist, i18n, and ssr/client/dist folders in a non-release pull request. These folders are for release use only. |
|
Thanks for the review and the helpful context!! Thanks for explaining the Vue case too, where the chart instance becomes reactive and [seriesModel.coordinateSystem] gets lost, and how I've pushed a follow-up commit that adds a dev warning before skipping the render, instead of skipping silently: [ECharts] Heatmap will not be rendered because its coordinate system is missing. Please make sure the coordinate system is declared and its component is imported. It only logs once so it doesn't repeat on every render. Please let me know if you would like different wording. Thanks again!! |
|
@aloktomarr You were right to mention that ECharts already emits a warning when a coordinate system cannot be resolved. I had overlooked that and suggested an additional heatmap-specific warning unnecessarily. I’ve just pushed a follow-up commit to remove the redundant log. Sorry for the extra churn. |
|
@plainheart No worries at all!! thanks for the quick follow-up and for cleaning it up! |
…ad of crashing. close apache#19060 (cherry picked from commit bb5f1d5)
2cb161f to
c6741a7
Compare
|
Congratulations! Your PR has been merged. Thanks for your contribution! 👍 |
Brief Information
This pull request is in the type of:
What does this PR do?
Prevents
HeatmapView.renderfrom throwing when a heatmap's coordinate system cannot be resolved.Fixed issues
Details
Before: What was the problem?
HeatmapView.renderreadseriesModel.coordinateSystem.typewithout checking that the coordinate system existed. When a heatmap references a coordinate system whose component is missing (e.g.coordinateSystem: 'calendar'or'bmap'not registered),coordinateSystemisundefined, socoordSys.typethrewCannot read properties of undefined (reading 'type'), aborting the entire render.incrementalRenderalready guarded this case withif (coordSys), butrenderdid not.After: How does it behave after the fixing?
rendernow returns early when the coordinate system is missing (same guard asincrementalRender), so the misconfiguration is skipped gracefully — ECharts still emits its usual "coordinate system cannot be found" warning — instead of throwing. Added a regression unit test (test/ut/spec/series/heatmap.test.ts).Document Info
Misc
Security Checking
ZRender Changes
Merging options