fix(animations): do not throw errors when a destroyed component is animated (#23836)
PR Close #23836
This commit is contained in:
parent
474dbf09ec
commit
d2a86872a9
|
@ -649,8 +649,11 @@ export class TransitionAnimationEngine {
|
||||||
|
|
||||||
trigger(namespaceId: string, element: any, name: string, value: any): boolean {
|
trigger(namespaceId: string, element: any, name: string, value: any): boolean {
|
||||||
if (isElementNode(element)) {
|
if (isElementNode(element)) {
|
||||||
this._fetchNamespace(namespaceId).trigger(element, name, value);
|
const ns = this._fetchNamespace(namespaceId);
|
||||||
return true;
|
if (ns) {
|
||||||
|
ns.trigger(element, name, value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -616,6 +616,13 @@ const DEFAULT_NAMESPACE_ID = 'id';
|
||||||
expect(element.contains(child1)).toBe(true);
|
expect(element.contains(child1)).toBe(true);
|
||||||
expect(element.contains(child2)).toBe(true);
|
expect(element.contains(child2)).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not throw an error if a missing namespace is used', () => {
|
||||||
|
const engine = makeEngine();
|
||||||
|
const ID = 'foo';
|
||||||
|
const TRIGGER = 'fooTrigger';
|
||||||
|
expect(() => { engine.trigger(ID, element, TRIGGER, 'something'); }).not.toThrow();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in New Issue