fix: DefaultCameraManager event listener leak #4509
Merged
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.
Type of change
Jira ticket 馃摌
https://cognitedata.atlassian.net/browse/
Description 馃摑
This PR deregisters an event listener that is placed on the document when creating a tween animation, but is currently only removed if the tween is cancelled. There is now a call to deregister the event listener when the tween completes as well.
How has this been tested? 馃攳
I've tested this by creating a viewer, calling a fit to view method on the DefaultCameraManager, then disposing of the viewer. After this you should be able to take a chrome heap snapshot to see if the WebGL context is still reachable from the window.
Test instructions 鈩癸笍
Create a viewer (using the DefaultCameraManager)
Call the method to fit the camera to view
Dispose of the viewer
Take a chrome heap snapshot and search for
Detached WebGL2RenderingContext
Viewer.tsx
Checklist 鈽戯笍