Xnadir opened a new pull request, #21864: URL: https://github.com/apache/echarts/pull/21864
## Brief Information This pull request is in the type of: - [x] bug fixing - [ ] new feature - [ ] others ### What does this PR do? Keeps the gauge's progress element list on every render, so turning the progress on after a render with neither pointer nor progress no longer throws. ### Fixed issues - #21863: Gauge throws "Cannot read properties of undefined (reading '0')" when switching to a progress style ## Details ### Before: What was the problem? `GaugeView._renderMain` stored `this._progressEls` only inside `if (showProgress || showPointer)`. With `pointer.show: false` and `progress.show: false`, it was never set, or it kept the elements of an older render. The next `setOption` with `progress.show: true` read `oldProgressData[oldIdx]` in the update branch, which threw `TypeError: Cannot read properties of undefined (reading '0')`, and no ring was drawn. ### After: How does it behave after the fixing? `this._progressEls = progressList` now runs on every render, outside that `if`. After a render that draws no progress the list is empty, so the update branch starts the ring from `startAngle`, as it does for a new item. New unit test `test/ut/spec/series/gauge.test.ts`: - "number only" (no pointer, no progress), then "ring" (progress on): no throw, and one more progress sector is drawn. On `master` it fails with the TypeError. - progress on, off, on again: no throw. Ran locally: `npx jest --config test/ut/jest.config.cjs test/ut/spec/series` (7 passed), `eslint` on the changed files, `tsc -p tsconfig.json --noEmit`. ## Document Info - [x] This PR doesn't relate to document changes ## Misc ### Security Checking - [ ] This PR uses security-sensitive Web APIs. ### ZRender Changes - [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx). ### Related test cases or examples to use the new APIs N.A. ### Merging options - [ ] Please squash the commits into a single one when merging. ### Other information This change was written with the help of Claude Code (AI). I reviewed it and ran the tests above. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
