-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(animations): Ensure elements are removed from the cache after leave animation. #50929
Conversation
1e4ea00
to
10a8d95
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for investigating, this must have been hard to track down!
|
||
expect(engine.elementContainsData(DEFAULT_NAMESPACE_ID, element)).toBeTruthy(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test definitely looked broken before, with both these elementContainsData
calls being checked to return true even after removal and flush. I'd suggest also removing the first elementContainsData
assertion as it seems rather meaningless with the new assertions, and it allows dropping test-only elementContainsData
implementations from production code (both from TransitionAnimationsEngine
and AnimationTransitionNamespace
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great suggestion ! I'll remove it !
this.afterFlushAnimationsDone(() => ns.destroy(context)); | ||
this.afterFlushAnimationsDone(() => { | ||
ns.destroy(context); | ||
delete this._namespaceLookup[namespaceId]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit unfortunate to me that cleanup logic is (still) spread across two phases, especially now that we've seen that first-phase cleanup can remove needed state too early. Apparently the destroyed namespace is still interacting with this engine, so arguably we should not be cleaning it up until those interactions can no longer occur entirely?
tldr; can all of the afterFlush
work be pushed into this second phase, or would that result in issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like, we're good with moving everything into afterFlushAnimationsDone
!
…ve animation. This commit fixes a memory leak. `_namespaceLookup` was cleared before the call to `processLeaveNode()` which was using the lookup. Without that lookup `clearElementCache()` wasn't called thus keeping a reference to the element. Fixes angular#24197 & angular#50533
10a8d95
to
f0e1011
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work fixing this!
This PR was merged into the repository by commit a14bdfe. |
…ve animation. (angular#50929) This commit fixes a memory leak. `_namespaceLookup` was cleared before the call to `processLeaveNode()` which was using the lookup. Without that lookup `clearElementCache()` wasn't called thus keeping a reference to the element. Fixes angular#24197 & angular#50533 PR Close angular#50929
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
…ve animation. (angular#50929) This commit fixes a memory leak. `_namespaceLookup` was cleared before the call to `processLeaveNode()` which was using the lookup. Without that lookup `clearElementCache()` wasn't called thus keeping a reference to the element. Fixes angular#24197 & angular#50533 PR Close angular#50929
…ve animation. (angular#50929) This commit fixes a memory leak. `_namespaceLookup` was cleared before the call to `processLeaveNode()` which was using the lookup. Without that lookup `clearElementCache()` wasn't called thus keeping a reference to the element. Fixes angular#24197 & angular#50533 PR Close angular#50929
This commit fixes a memory leak where references were retained in multiple
Map
structures._namespaceLookup
was cleared before the call toprocessLeaveNode()
which was using the lookup.Without that lookup
clearElementCache()
wasn't called thus keeping a reference to the element.Fixes #24197 & #50533
PR Type
What kind of change does this PR introduce?
Does this PR introduce a breaking change?