angular/packages/core
Jessica Janiuk a4001c440f fix(core): Prevent leave animations on a move operation (#63745)
When a user has `animate.leave` on a list of items in a `@for`, but are only showing a subset using a computed, removing the second to last item results in a move operation on the last item. There's no native atomic move API in the browser. So this results in the element being detached and attached at its new index. The detaching of the node resulted in leave animations firing.
This fix addresses this by adding a flag in the `LView[ANIMATIONS]` `AnimationLViewData` interface to allow for skipping animations. During list reconciliation, we set this flag so that the animations are skipped over. The flag is flipped back after the move operation is complete.

There is one complication that results from this. The index adjustment of elements in the list happens synchronously while the leave animation is asynchronous. This results in the leaving item getting shifted to the end of the list. This is not ideal but likely can be addressed in a future refactor.

fixes: #63544

PR Close #63745
2025-09-12 15:21:24 +00:00
..
global build: rename defaults2.bzl to defaults.bzl (#63383) 2025-08-25 15:45:01 -07:00
primitives refactor(core): Split consumerBefore/AfterComputation (#62549) 2025-09-11 15:47:33 +00:00
rxjs-interop fix(core): Explicit Zone CD in TestBed providers should not override TestBed error handler (#63404) 2025-09-02 09:26:44 -07:00
schematics feat(core): introduce BootstrapContext for improved server bootstrapping (#63562) 2025-09-09 10:57:09 -07:00
src fix(core): Prevent leave animations on a move operation (#63745) 2025-09-12 15:21:24 +00:00
test fix(core): Prevent leave animations on a move operation (#63745) 2025-09-12 15:21:24 +00:00
testing fix(core): Explicit Zone CD in TestBed providers should not override TestBed error handler (#63404) 2025-09-02 09:26:44 -07:00
BUILD.bazel build: rename defaults2.bzl to defaults.bzl (#63383) 2025-08-25 15:45:01 -07:00
index.ts refactor: update packages/core:{core,src} to ts_project (#61275) 2025-05-14 12:01:51 +00:00
package.json fix(core): mark zone.js as an optional peer dependency (#61616) 2025-05-22 12:14:06 -07:00
PACKAGE.md
public_api.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
tsconfig-build.json build: migrate more targets of @angular/core to ts_project (#61370) 2025-05-16 11:02:07 +00:00
tsconfig-test.json build: migrate more targets of @angular/core to ts_project (#61370) 2025-05-16 11:02:07 +00:00