laodouya opened a new issue, #21706: URL: https://github.com/apache/echarts/issues/21706
### Version 6.1.0 ### Link to Minimal Reproduction [Official Editor (open the browser console)](https://echarts.apache.org/examples/en/editor.html?code=PTAEFMGMAsEMCcAuBnUA2AdARgwBlPOAOaHLICWA9gHYBcosoR4lwAtrAA6gwKKgB3aJWTgeNRLHLVw8UOVS4AHrgBQIUAApwGIhlDRyAEyPhqoAG7lGRhZwA2sAJ61qNMUPL2x5fgFdOI1hEcGQASlBEaHhKAWR1MFBQABUnTnAAUXgY-HoAYVhqN35CWCNQThj0pHJQ0EoAM1BqP3t7LVLbaiJQAHJcXrCElOgxZFg2MUhKU0FKeABrVAbpMRoIXiRUTFw8DFVVSk5EKnMAXlAAb1Ukk8RvekvI8CVEel6AeXTzKLEAIxicVk4moyEoD0io1AAC9ZJQALQUWHlZiUHhwJCQwgCermUSIL4nGi9UAAX1UpIA3AcNABZaTkDjtdzwzjgpxEdYcbjwyFiWCQRB-WDtADiLAAUgBlD4AOXkqHI2XA3gshUQqigGJQGEIRAUIXgtK4ml6J2oTl6ABorjdImlwO8AGLgYJ-Qh5cHeQWna12hquoWkegAbTtSWuSSj9vSzsD7vAfujSUqR1kJ1Cj2aE0dfQAgiTSVbw1HUZNEPAXLbk1HEA73gAFdmc6hJmvieZdYKZ0Ahvu4G24AC6NpDWAHoGHo_HNvHI97E7no4nw6HQ5LSXJ0a3oHXpLC1OGAC04YjyMj0Xx6EJghttahRHUhGY-SDJKs5ApQLZkA5nK53FUNU5EMEwzAAEXICxQAuIxKEgPxJmoRAMEgUoQgybwkMQU1bAsQZqWAmE4TybUYLvPhkAwBkcNA0xqEgiwbRaNobSeARjCiegJ1GcgiGgN5JzJA8aTAZJoliVB1kwHAJxWGRcXQPY1FhGJSL4DB8UJU5NEjJgWCzbl3nNS0yWLJJRHgWpkFDEsnjrWM-mQSBgkNa0O3gL sQilJxkBCNh3lRdygkkUMnmoHN3iUdy1XsPxcxDABWG1ktALAhzJDKdz3ESgA=) ### Steps to Reproduce 1. Register any map (a one-polygon GeoJSON is enough — the actual map data is irrelevant). 2. Create a chart whose size is `0×0` — exactly what happens in real apps when the chart's container is hidden with `display: none` (responsive breakpoint, inactive tab, closing dialog) and something triggers `setOption`/`resize`: ```js echarts.registerMap('tiny', { type: 'FeatureCollection', features: [{ type: 'Feature', properties: { name: 'A' }, geometry: { type: 'Polygon', coordinates: [[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]] } }] }); var chart = echarts.init(document.createElement('div'), null, { width: 0, height: 0 }); chart.setOption({ geo: { map: 'tiny' }, series: [{ type: 'scatter', coordinateSystem: 'geo', data: [{ name: 'x', value: [5, 5, 1] }] }] }); ``` The same happens on an already-rendered geo chart when calling `chart.resize({ width: 0, height: 0 })`. **This is a regression introduced in 6.1.0.** Running the identical snippet against 6.0.0 completes without error; against 6.1.0 it throws (verified with a side-by-side Node A/B on `6.0.0` vs `6.1.0`). ### Current Behavior ``` TypeError: Cannot read properties of null (reading '0') at copy (zrender/lib/core/matrix.js:14) at legacyCopyOverallTrans (echarts/lib/coord/View.js) at viewCoordSysUpdateOverallTrans (echarts/lib/coord/View.js) at viewCoordSysUpdateTransform (echarts/lib/coord/View.js) at viewCoordSysSetViewRect (echarts/lib/coord/View.js) at resizeGeo (echarts/lib/coord/geo/geoCreator.js) at GeoCreator.create (echarts/lib/coord/geo/geoCreator.js) ``` Root cause (from reading the 6.1.0 source): with a zero-sized view rect the overall transform has zero scale, so its determinant is 0 and zrender's `matrix.invert()` returns `null` (without writing `out`). In `src/coord/View.ts`, `viewCoordSysUpdateOverallTrans` passes that return value to `legacyCopyOverallTrans` unguarded: ```ts const mtOverallInv = matrixInvert(viewInner.mtOverallInv, mtOverall); // null when singular legacyCopyOverallTrans(viewInner, overallTrans, mtOverall, mtOverallInv); legacyCopyOverallTrans(viewInner.lgGeo, overallTrans, mtOverall, mtOverallInv); ``` and `legacyCopyOverallTrans` does `matrixCopy(target.invTransform || (target.invTransform = []), mtOverallInv)` → `null[0]` → the TypeError. In 6.0.0 the equivalent code (`View.prototype._updateTransform`) ignored `invert()`'s return value — `invTransform` simply kept its previous contents — and readers guarded with `invTransform ? ... : ...`, so zero-sized geo charts were tolerated. Since the failure happens inside the render/update pipeline, in real apps it re-throws on every animation frame until the chart is disposed, producing large bursts of identical errors in error trackers. ### Expected Behavior No crash. A geo/map chart in a zero-sized (hidden) container should be tolerated like in 6.0.0 — e.g. skip the inverse-transform copy when `matrixInvert` returns `null`, keeping the previous/stale inverse just as 6.0.0 did. I'm happy to submit a PR with the null guard if this direction is acceptable. ### Environment ```markdown - OS: macOS 15 / Windows 11 / iOS 26 (all affected) - Browser: Chrome 150, Edge 150, Mobile Safari 26 (any browser) - Framework: reproducible with plain echarts; originally hit via echarts-for-react when a responsive layout hides a mounted geo chart with `display: none` and the resize handler runs at 0×0 ``` ### Any additional comments? The frequent real-world trigger is a chart inside a container hidden by a responsive CSS breakpoint (`display: none` on small screens): rotating a phone or resizing the window across the breakpoint makes resize observers call `chart.resize()` at `0×0` while the chart is still mounted, which crashes every geo/map chart on 6.1.0. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
