fix(toolbox): fix updateView and dispose silently no-oping on toolbox features#21684
Open
mzabuawala wants to merge 1 commit into
Open
fix(toolbox): fix updateView and dispose silently no-oping on toolbox features#21684mzabuawala wants to merge 1 commit into
mzabuawala wants to merge 1 commit into
Conversation
… features ToolboxView._features is a zrender HashMap (created via createHashMap()), which stores entries in an internal native Map. zrUtil.each() iterates it as a plain object, so the callbacks in updateView and dispose never received any feature and both methods silently did nothing. As a result feature dispose was never called, leaking each feature's resources whenever the view was disposed. For the dataZoom feature this leaks its BrushController: the controller's zr mouse handlers stay bound, and each leaked controller paints its own semi-transparent cover on drag-to-zoom, so the selection overlay gets progressively darker after every dispose/render cycle. Feature updateView was likewise never invoked on chart updates. Iterate with the HashMap's own .each() instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Brief Information
This pull request is in the type of:
What does this PR do?
fix updateView and dispose silently no-oping on toolbox features
Fixed issues
ToolboxView._features is a zrender HashMap (created via createHashMap()), which stores entries in an internal native Map. zrUtil.each() iterates it as a plain object, so the callbacks in updateView and dispose never received any feature and both methods silently did nothing.
As a result feature dispose was never called, leaking each feature's resources whenever the view was disposed. For the dataZoom feature this leaks its BrushController: the controller's zr mouse handlers stay bound, and each leaked controller paints its own semi-transparent cover on drag-to-zoom, so the selection overlay gets progressively darker after every dispose/render cycle. Feature updateView was likewise never invoked on chart updates.
Iterate with the HashMap's own .each() instead.
Details
Before: What was the problem?
ToolboxView._features is a zrender HashMap (created via createHashMap()), which stores entries in an internal native Map. zrUtil.each() iterates it as a plain object, so the callbacks in updateView and dispose never received any feature and both methods silently did nothing.
After: How does it behave after the fixing?
Iterate with the HashMap's own .each() instead.
Document Info
One of the following should be checked.
Misc
Security Checking
ZRender Changes
Related test cases or examples to use the new APIs
N.A.
Merging options
Other information