Skip to content

Commit 94adecd

Browse files
crisbetokara
authored andcommitted
refactor(focus-origin-monitor): complete stream when stopping monitor (#3404)
1 parent 63d4359 commit 94adecd

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/lib/core/style/focus-origin-monitor.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,15 @@ export class FocusOriginMonitor {
102102
* @param element The element to stop monitoring.
103103
*/
104104
unmonitor(element: Element): void {
105-
if (!this._elementInfo.has(element)) {
106-
return;
105+
let elementInfo = this._elementInfo.get(element);
106+
107+
if (elementInfo) {
108+
elementInfo.unlisten();
109+
elementInfo.subject.complete();
110+
111+
this._setClasses(element, null);
112+
this._elementInfo.delete(element);
107113
}
108-
this._elementInfo.get(element).unlisten();
109-
this._setClasses(element, null);
110-
this._elementInfo.delete(element);
111114
}
112115

113116
/**

0 commit comments

Comments
 (0)