fix(heatmap): skip render when the coordinate system is missing inste…#21698
fix(heatmap): skip render when the coordinate system is missing inste…#21698aloktomarr wants to merge 1 commit into
Conversation
…ad of crashing. close apache#19060
|
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. |
| // The coordinate system may be unresolved, e.g. a heatmap that | ||
| // references a `calendar`/`geo`/`bmap` coordinate system whose component | ||
| // is missing. Skip rendering instead of throwing on `coordSys.type` | ||
| // (`incrementalRender` already guards this the same way). See #19060. | ||
| if (!coordSys) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
Hi, thanks for the contribution! For #19060, it generally happens in a Vue setup because the ECharts instance can be proxied and seriesModel.coordinateSystem can be lost unexpectedly. See also #17723 (comment). For users on ECharts versions before 6.1.0, the recommended workaround is still to avoid making the ECharts instance reactive (for example, with shallowRef or markRaw); in ECharts 6.1.0 and later, this is no longer necessary. (PR #21293)
In the scenario covered by your regression test, where a series references an unregistered or undeclared coordinate system, I think your fix makes sense. It would be even better to emit a development warning/log before returning, rather than silently skipping the render.
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