From e2281023780297f29cfff087aeea913bfc686cd7 Mon Sep 17 00:00:00 2001 From: Jessica Janiuk Date: Fri, 10 Oct 2025 11:02:42 +0200 Subject: [PATCH] fix(core): Prevents early style pruning with leave animations (#64335) In some cases, the leave animation stylesheets were getting pruned too early due to the renderer removal happening before the animation function was run. This ensures that while queuing a leave animation, we guarantee the lView is referenced in the leaving animations set. This guarantees the style sheet pruning knows about the animations existing and skips the prune step. fixes: #64326 PR Close #64335 --- packages/core/src/render3/node_manipulation.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/core/src/render3/node_manipulation.ts b/packages/core/src/render3/node_manipulation.ts index 4b24c7a4f6d..923597f8977 100644 --- a/packages/core/src/render3/node_manipulation.ts +++ b/packages/core/src/render3/node_manipulation.ts @@ -407,6 +407,8 @@ function runLeaveAnimationsWithCallback( return callback(false); } + if (lView) allLeavingAnimations.add(lView); + addToAnimationQueue(injector, () => { // it's possible that in the time between when the leave animation was // and the time it was executed, the data structure changed. So we need