Skip to content

Commit 2668351

Browse files
committed
fix(cdk/observers): Run content changed callback in NgZone
1 parent f10a158 commit 2668351

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/cdk/observers/observe-content.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
Injectable,
1616
Input,
1717
NgModule,
18-
NgZone,
1918
OnDestroy,
2019
Output,
2120
booleanAttribute,
@@ -202,7 +201,6 @@ export class CdkObserveContent implements AfterContentInit, OnDestroy {
202201
constructor(
203202
private _contentObserver: ContentObserver,
204203
private _elementRef: ElementRef<HTMLElement>,
205-
private _ngZone: NgZone,
206204
) {}
207205

208206
ngAfterContentInit() {
@@ -219,15 +217,9 @@ export class CdkObserveContent implements AfterContentInit, OnDestroy {
219217
this._unsubscribe();
220218
const stream = this._contentObserver.observe(this._elementRef);
221219

222-
// TODO(mmalerba): We shouldn't be emitting on this @Output() outside the zone.
223-
// Consider brining it back inside the zone next time we're making breaking changes.
224-
// Bringing it back inside can cause things like infinite change detection loops and changed
225-
// after checked errors if people's code isn't handling it properly.
226-
this._ngZone.runOutsideAngular(() => {
227-
this._currentSubscription = (
228-
this.debounce ? stream.pipe(debounceTime(this.debounce)) : stream
229-
).subscribe(this.event);
230-
});
220+
this._currentSubscription = (
221+
this.debounce ? stream.pipe(debounceTime(this.debounce)) : stream
222+
).subscribe(this.event);
231223
}
232224

233225
private _unsubscribe() {

0 commit comments

Comments
 (0)