Skip to content

fix(toolbox): fix updateView and dispose silently no-oping on toolbox features#21684

Open
mzabuawala wants to merge 1 commit into
apache:masterfrom
mzabuawala:fix-toolbox-view
Open

fix(toolbox): fix updateView and dispose silently no-oping on toolbox features#21684
mzabuawala wants to merge 1 commit into
apache:masterfrom
mzabuawala:fix-toolbox-view

Conversation

@mzabuawala

Copy link
Copy Markdown

Brief Information

This pull request is in the type of:

  • [ x] bug fixing
  • new feature
  • others

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.

  • 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

  • Please squash the commits into a single one when merging.

Other information

… 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant