clientIO / joint

A proven SVG-based JavaScript diagramming library powering exceptional UIs
https://jointjs.com
Mozilla Public License 2.0
4.45k stars 841 forks source link

fix(dia.Paper): don't leak animation frame request #2561

Closed bendemboski closed 2 months ago

bendemboski commented 2 months ago

Description

This ensures that when Paper.resetViews() is called, any pending animation frame request is not leaked.

Motivation and Context

When resetViews() calls _resetUpdates() it's possible that there's an animation frame request, but _resetUpdates() was not checking for this and cancelling any such request, potentially causing updateViewsAsync() to be called when it shouldn't be.

This can cause unexpected behavior if the paper was frozen, or cause an error to be thrown if the paper is removed (since updateViewsAsync() with throw in such a case).

kumilingus commented 2 months ago

Perhaps a proper fix for https://github.com/clientIO/joint/issues/2061 as well. Thank you @bendemboski.