angular/packages/core/src
Jessica Janiuk 3ec8a5c753 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:25 +00:00
..
animation fix(core): Prevent leave animations on a move operation (#63745) 2025-09-12 15:21:25 +00:00
application feat(core): introduce BootstrapContext for improved server bootstrapping (#63636) 2025-09-09 10:45:02 -07:00
authoring docs: use correct closing quote in input and model import usage notes (#63237) 2025-08-19 12:33:24 +00:00
change_detection refactor(core): replace Optional/SkipSelf deps with inject() flags (#63386) 2025-08-28 08:43:17 -07:00
compiler build: rename defaults2.bzl to defaults.bzl (#63384) 2025-08-25 15:45:46 -07:00
debug refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
defer fix(core): unable to retrieve defer blocks in tests when component injects ViewContainerRef (#62156) 2025-06-23 14:24:46 +02:00
di build: rename defaults2.bzl to defaults.bzl (#63384) 2025-08-25 15:45:46 -07:00
hydration Revert "feat(platform-browser): Add IsolatedShadowDom encapsulation method (#62723)" (#63142) 2025-08-13 11:12:59 -07:00
i18n docs(core): correct standalone jsdocs (#62025) 2025-06-12 15:51:23 +02:00
interface build: rename defaults2.bzl to defaults.bzl (#63384) 2025-08-25 15:45:46 -07:00
internal refactor(core): account for anonymous classes in internal utility (#58392) 2024-10-28 12:38:03 -07:00
linker feat(core): Add destroyed property to EnvironmentInjector (#61951) 2025-06-24 14:09:10 +00:00
metadata docs: update to new standalone default behavior (#63329) 2025-08-27 11:26:13 -07:00
platform feat(core): introduce BootstrapContext for improved server bootstrapping (#63636) 2025-09-09 10:45:02 -07:00
reflection build: rename defaults2.bzl to defaults.bzl (#63384) 2025-08-25 15:45:46 -07:00
render docs: add link label & paragraph for correct display (#60708) 2025-04-30 08:18:07 -07:00
render3 fix(core): Prevent leave animations on a move operation (#63745) 2025-09-12 15:21:25 +00:00
resource refactor(core): remove temporary resource setter function. (#63097) 2025-08-11 15:43:48 -07:00
sanitization refactor: add explicit types for exports relying on inferred call return type (#61312) 2025-05-13 22:45:18 +00:00
testability fix(core): cleanup testability subscriptions (#61261) 2025-05-21 12:06:23 +00:00
util build: add a noDuplicateEnumValue rule (#63483) 2025-09-10 22:16:11 +00:00
view refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
zone docs: update API examples to modern angular (#61688) 2025-05-29 17:53:28 -04:00
authoring.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
cached_injector_service.ts refactor: add @__PURE__ next to @pureOrBreakMyCode for improved bundler compatibility (#58297) 2024-10-28 12:26:05 -07:00
change_detection.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
console.ts refactor: remove unnecessary TSLint rule flags (#59365) 2025-01-07 16:06:21 +00:00
core.externs.js refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
core.ts fix(core): fixes empty animations when recalculating styles (#63007) 2025-08-06 11:17:30 +02:00
core_private_export.ts refactor(core): dispatch enter and leave animations at the right times (#63710) 2025-09-10 22:24:31 +00:00
core_reactivity_export.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
core_reactivity_export_internal.ts refactor(core): convert scripts within packages/core/src to relative imports (#60227) 2025-03-25 10:58:00 -07:00
core_render3_private_export.ts refactor(core): dispatch enter and leave animations at the right times (#63710) 2025-09-10 22:24:31 +00:00
di.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
document.ts feat(core): move DOCUMENT token into core (#60663) 2025-04-01 12:48:06 +00:00
error_details_base_url.ts refactor(core): Error logs links point to the archived version of the docs (#63512) 2025-09-10 22:21:10 +00:00
error_handler.ts fix(core): avoid injecting ErrorHandler from a destroyed injector (#61886) 2025-06-24 14:13:34 +00:00
errors.ts fix(core): properly recognize failed fetch responses when loading external resources in JIT (#62992) 2025-08-05 10:10:56 +02:00
event_delegation_utils.ts fix(core): enable stashing only when withEventReplay() is invoked (#61077) 2025-05-14 10:35:57 -07:00
event_emitter.ts fix(core): async EventEmitter error should not prevent stability (#61028) 2025-04-29 22:14:15 -07:00
image_performance_warning.ts refactor(common): replace forEach with index loop for Domino compatibility (#62290) 2025-06-26 12:01:36 +00:00
linker.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
metadata.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
ng_reflect.ts refactor(core): stop producing ng-reflect attributes by default (#60973) 2025-04-24 10:07:35 -07:00
pending_tasks.ts docs(docs-infra): Add version of introduction for APIs (#60814) 2025-05-02 07:51:33 -07:00
profiler.ts docs: update comment (#62482) 2025-07-07 16:52:15 +00:00
r3_symbols.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
render.ts feat(core): add event listener options to renderer (#59092) 2024-12-10 13:39:47 -08:00
transfer_state.ts refactor(core): add a getTransferState for the devtools (#62722) 2025-07-21 17:00:27 -04:00
type_checking.ts refactor(core): expose function to assert type of variables (#62648) 2025-07-16 12:40:25 +02:00
version.ts refactor(core): mark VERSION as @__PURE__ for better tree-shaking (#63400) 2025-08-27 11:39:07 -07:00
zone.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00