ChimdumebiNebolisa opened a new pull request, #21481:
URL: https://github.com/apache/echarts/pull/21481
## Brief Information
This pull request is in the type of:
- [x] bug fixing
- [ ] new feature
- [ ] others
### What does this PR do?
Fixes treemap `dispatchAction({ type: 'select', dataIndex })` so that
selection targets a single node even when multiple nodes share the same name.
### Fixed issues
- #21480
## Details
### Before: What was the problem?
When using `dispatchAction({ type: 'select', dataIndex })` on a treemap that
contains multiple nodes with the same `name` and no explicit `id`, the
selection logic could select multiple nodes or behave inconsistently.
This happened because the internal selection state (`selectedMap`) was keyed
by node `name` first, causing key collisions when names were duplicated.
### After: How does it behave after the fixing?
Selection is now keyed by `data.getId(dataIndex)`, which is guaranteed to be
unique.
As a result:
- `dispatchAction({ type: 'select', dataIndex })` deterministically selects
only the intended treemap node
- Duplicate node names no longer cause selection collisions
- Existing behavior for series that already rely on IDs remains unchanged
A minimal reproduction case (`test/treemap-select-21480.html`) confirms that
only the targeted node is selected.
## Document Info
- [x] This PR doesn't relate to document changes
- [ ] The document should be updated later
- [ ] The document changes have been made in apache/echarts-doc#xxx
## 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
- [x] Please squash the commits into a single one when merging.
### Other information
N/A
--
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]