fix: prevent child nodes from disappearing in v5 by disabling parent selection #21449
+77,176
−92,101
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
This PR addresses a rendering regression observed in ECharts v5 when dealing with hierarchical structures (Treemap/Graph) that utilize upperLabel. Under specific interaction sequences, child nodes would intermittently disappear from the canvas.
Problem Analysis
The issue occurs when a parent node (e.g., a container like 'Blob' or 'Pool') enters the selected state while upperLabel is active. The internal state transition logic in v5 seems to conflict with the rendering of child elements during hover-in and hover-out events on a selected parent.
Key observations:
Proposed Solution
Since the select state logic for labeled parent containers is currently unstable, this PR introduces a safeguard by setting select: { disabled: true } for parent-level nodes. This ensures that:
This is a non-breaking workaround that maintains the core functionality of the diagram while fixing the "disappearing nodes" bug for end-users.
Test Cases
1.Initialize a Treemap with hierarchical data and upperLabel: { show: true }.
2.Click to select a parent node.
3.Move the cursor in and out of the parent node's boundary.
Result: All child nodes remain visible.
Type of Change
Bug fix
Documentation update
Related Issue: #20098