Skip to content

Commit ed6a347

Browse files
thePunderWomanAndrewKushnir
authored andcommitted
refactor(core): prevent timeout from applying to non-event animation bindings (#63393)
The 4 second removal timeout was applying in all cases, but it should only actually apply to the situation where the event binding syntax is used for animate.leave. This ensures that's the only case in which it'll apply. PR Close #63393
1 parent 6d6b027 commit ed6a347

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

packages/core/src/animation/element_removal_registry.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export class ElementRegistry {
6565
const details = this.outElements.get(el) ?? {
6666
classes: null,
6767
animateFn: () => {},
68+
isEventBinding: true,
6869
};
6970
details.animateFn = animateWrapperFn(el, value);
7071
this.outElements.set(el, details);
@@ -75,6 +76,7 @@ export class ElementRegistry {
7576
const details = this.outElements.get(el) ?? {
7677
classes: new Set<string>(),
7778
animateFn: (): void => {},
79+
isEventBinding: false,
7880
};
7981
if (typeof value === 'function') {
8082
this.trackResolver(details, value);
@@ -109,8 +111,11 @@ export class ElementRegistry {
109111
};
110112
// this timeout is used to ensure elements actually get removed in the case
111113
// that the user forgot to call the remove callback. The timeout is cleared
112-
// in the DOM renderer during the remove child process.
113-
timeoutId = setTimeout(remove, maxAnimationTimeout);
114+
// in the DOM renderer during the remove child process. It only applies
115+
// to the event binding use case.
116+
if (details.isEventBinding) {
117+
timeoutId = setTimeout(remove, maxAnimationTimeout);
118+
}
114119
details.animateFn(remove);
115120
}
116121
}

packages/core/src/animation/interfaces.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,5 @@ export interface AnimationDetails {
6767
classes: Set<string> | null;
6868
classFns?: Function[];
6969
animateFn: AnimationRemoveFunction;
70+
isEventBinding: boolean;
7071
}

0 commit comments

Comments
 (0)