Skip to content

Commit

Permalink
fix(animations): do not throw errors when a destroyed component is an…
Browse files Browse the repository at this point in the history
…imated (#23836)

PR Close #23836
  • Loading branch information
matsko committed May 11, 2018
1 parent 56be337 commit 752b83a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,11 @@ export class TransitionAnimationEngine {

trigger(namespaceId: string, element: any, name: string, value: any): boolean {
if (isElementNode(element)) {
this._fetchNamespace(namespaceId).trigger(element, name, value);
return true;
const ns = this._fetchNamespace(namespaceId);
if (ns) {
ns.trigger(element, name, value);
return true;
}
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,13 @@ const DEFAULT_NAMESPACE_ID = 'id';
expect(element.contains(child1)).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();
});
});
});
})();
Expand Down

0 comments on commit 752b83a

Please sign in to comment.