diff --git a/packages/core/src/render3/component_ref.ts b/packages/core/src/render3/component_ref.ts index c5ee9dc3b2b65..3aeca1fa8a340 100644 --- a/packages/core/src/render3/component_ref.ts +++ b/packages/core/src/render3/component_ref.ts @@ -51,7 +51,7 @@ import {computeStaticStyling} from './styling/static_styling'; import {mergeHostAttrs, setUpAttributes} from './util/attrs_utils'; import {debugStringifyTypeForError, stringifyForError} from './util/stringify_utils'; import {getComponentLViewByIndex, getNativeByTNode, getTNode} from './util/view_utils'; -import {ViewRef} from './view_ref'; +import {RootViewRef, ViewRef} from './view_ref'; export class ComponentFactoryResolver extends AbstractComponentFactoryResolver { /** @@ -319,11 +319,7 @@ export class ComponentRef extends AbstractComponentRef { private _tNode: TElementNode|TContainerNode|TElementContainerNode) { super(); this.instance = instance; - this.hostView = this.changeDetectorRef = new ViewRef( - _rootLView, - undefined, /* _cdRefInjectingView */ - false, /* notifyErrorHandler */ - ); + this.hostView = this.changeDetectorRef = new RootViewRef(_rootLView); this.componentType = componentType; } diff --git a/packages/core/src/render3/view_ref.ts b/packages/core/src/render3/view_ref.ts index 8082311c5ee35..6aeaedc35bb76 100644 --- a/packages/core/src/render3/view_ref.ts +++ b/packages/core/src/render3/view_ref.ts @@ -57,7 +57,7 @@ export class ViewRef implements EmbeddedViewRef, InternalViewRef, ChangeDe * * This may be different from `_lView` if the `_cdRefInjectingView` is an embedded view. */ - private _cdRefInjectingView?: LView, private readonly notifyErrorHandler = true) {} + private _cdRefInjectingView?: LView) {} get context(): T { return this._lView[CONTEXT] as unknown as T; @@ -284,8 +284,7 @@ export class ViewRef implements EmbeddedViewRef, InternalViewRef, ChangeDe * See {@link ChangeDetectorRef#detach} for more information. */ detectChanges(): void { - detectChangesInternal( - this._lView[TVIEW], this._lView, this.context as unknown as {}, this.notifyErrorHandler); + detectChangesInternal(this._lView[TVIEW], this._lView, this.context as unknown as {}); } /** @@ -296,8 +295,7 @@ export class ViewRef implements EmbeddedViewRef, InternalViewRef, ChangeDe */ checkNoChanges(): void { if (ngDevMode) { - checkNoChangesInternal( - this._lView[TVIEW], this._lView, this.context as unknown as {}, this.notifyErrorHandler); + checkNoChangesInternal(this._lView[TVIEW], this._lView, this.context as unknown as {}); } } diff --git a/packages/core/test/bundling/animations-standalone/bundle.golden_symbols.json b/packages/core/test/bundling/animations-standalone/bundle.golden_symbols.json index b99c8599be319..e7f432226bb03 100644 --- a/packages/core/test/bundling/animations-standalone/bundle.golden_symbols.json +++ b/packages/core/test/bundling/animations-standalone/bundle.golden_symbols.json @@ -443,6 +443,9 @@ { "name": "RendererStyleFlags2" }, + { + "name": "RootViewRef" + }, { "name": "RuntimeError" }, @@ -821,6 +824,9 @@ { "name": "detectChangesInViewIfAttached" }, + { + "name": "detectChangesInternal" + }, { "name": "diPublicInInjector" }, diff --git a/packages/core/test/bundling/animations/bundle.golden_symbols.json b/packages/core/test/bundling/animations/bundle.golden_symbols.json index 073f6e93d01e8..09b6902a01a11 100644 --- a/packages/core/test/bundling/animations/bundle.golden_symbols.json +++ b/packages/core/test/bundling/animations/bundle.golden_symbols.json @@ -485,6 +485,9 @@ { "name": "RootComponent" }, + { + "name": "RootViewRef" + }, { "name": "RuntimeError" }, @@ -884,6 +887,9 @@ { "name": "detectChangesInViewIfAttached" }, + { + "name": "detectChangesInternal" + }, { "name": "diPublicInInjector" }, diff --git a/packages/core/test/bundling/cyclic_import/bundle.golden_symbols.json b/packages/core/test/bundling/cyclic_import/bundle.golden_symbols.json index 4106df9505942..40a252cfb8d6a 100644 --- a/packages/core/test/bundling/cyclic_import/bundle.golden_symbols.json +++ b/packages/core/test/bundling/cyclic_import/bundle.golden_symbols.json @@ -368,6 +368,9 @@ { "name": "RendererStyleFlags2" }, + { + "name": "RootViewRef" + }, { "name": "RuntimeError" }, @@ -665,6 +668,9 @@ { "name": "detectChangesInViewIfAttached" }, + { + "name": "detectChangesInternal" + }, { "name": "diPublicInInjector" }, diff --git a/packages/core/test/bundling/defer/bundle.golden_symbols.json b/packages/core/test/bundling/defer/bundle.golden_symbols.json index 48a5fcdea7f89..686a3be5804ef 100644 --- a/packages/core/test/bundling/defer/bundle.golden_symbols.json +++ b/packages/core/test/bundling/defer/bundle.golden_symbols.json @@ -419,6 +419,9 @@ { "name": "RendererStyleFlags2" }, + { + "name": "RootViewRef" + }, { "name": "RuntimeError" }, @@ -755,6 +758,9 @@ { "name": "detectChangesInViewIfAttached" }, + { + "name": "detectChangesInternal" + }, { "name": "diPublicInInjector" }, diff --git a/packages/core/test/bundling/forms_reactive/bundle.golden_symbols.json b/packages/core/test/bundling/forms_reactive/bundle.golden_symbols.json index 498fb7eea1a5a..7ede144dc40ff 100644 --- a/packages/core/test/bundling/forms_reactive/bundle.golden_symbols.json +++ b/packages/core/test/bundling/forms_reactive/bundle.golden_symbols.json @@ -506,6 +506,9 @@ { "name": "RootComponent" }, + { + "name": "RootViewRef" + }, { "name": "RuntimeError" }, @@ -908,6 +911,9 @@ { "name": "detectChangesInViewIfAttached" }, + { + "name": "detectChangesInternal" + }, { "name": "diPublicInInjector" }, diff --git a/packages/core/test/bundling/forms_template_driven/bundle.golden_symbols.json b/packages/core/test/bundling/forms_template_driven/bundle.golden_symbols.json index 922e162aeabac..52c2528d3d1f1 100644 --- a/packages/core/test/bundling/forms_template_driven/bundle.golden_symbols.json +++ b/packages/core/test/bundling/forms_template_driven/bundle.golden_symbols.json @@ -494,6 +494,9 @@ { "name": "RootComponent" }, + { + "name": "RootViewRef" + }, { "name": "RuntimeError" }, @@ -878,6 +881,9 @@ { "name": "detectChangesInViewIfAttached" }, + { + "name": "detectChangesInternal" + }, { "name": "diPublicInInjector" }, diff --git a/packages/core/test/bundling/hello_world/bundle.golden_symbols.json b/packages/core/test/bundling/hello_world/bundle.golden_symbols.json index b9f737eec05d5..1581f1b704a7a 100644 --- a/packages/core/test/bundling/hello_world/bundle.golden_symbols.json +++ b/packages/core/test/bundling/hello_world/bundle.golden_symbols.json @@ -281,6 +281,9 @@ { "name": "RendererFactory2" }, + { + "name": "RootViewRef" + }, { "name": "RuntimeError" }, @@ -524,6 +527,9 @@ { "name": "detectChangesInViewIfAttached" }, + { + "name": "detectChangesInternal" + }, { "name": "diPublicInInjector" }, diff --git a/packages/core/test/bundling/hydration/bundle.golden_symbols.json b/packages/core/test/bundling/hydration/bundle.golden_symbols.json index a906a365e9b80..0cb24e7aab597 100644 --- a/packages/core/test/bundling/hydration/bundle.golden_symbols.json +++ b/packages/core/test/bundling/hydration/bundle.golden_symbols.json @@ -428,6 +428,9 @@ { "name": "RendererStyleFlags2" }, + { + "name": "RootViewRef" + }, { "name": "RuntimeError" }, @@ -749,6 +752,9 @@ { "name": "detectChangesInViewIfAttached" }, + { + "name": "detectChangesInternal" + }, { "name": "diPublicInInjector" }, diff --git a/packages/core/test/bundling/router/bundle.golden_symbols.json b/packages/core/test/bundling/router/bundle.golden_symbols.json index 0075b57a9a15f..cbda420a4ae56 100644 --- a/packages/core/test/bundling/router/bundle.golden_symbols.json +++ b/packages/core/test/bundling/router/bundle.golden_symbols.json @@ -629,6 +629,9 @@ { "name": "ResolveStart" }, + { + "name": "RootViewRef" + }, { "name": "RouteConfigLoadEnd" }, @@ -1178,6 +1181,9 @@ { "name": "detectChangesInViewIfAttached" }, + { + "name": "detectChangesInternal" + }, { "name": "diPublicInInjector" }, diff --git a/packages/core/test/bundling/standalone_bootstrap/bundle.golden_symbols.json b/packages/core/test/bundling/standalone_bootstrap/bundle.golden_symbols.json index 4bb8f2963c06c..53f4a0f630ea9 100644 --- a/packages/core/test/bundling/standalone_bootstrap/bundle.golden_symbols.json +++ b/packages/core/test/bundling/standalone_bootstrap/bundle.golden_symbols.json @@ -332,6 +332,9 @@ { "name": "RendererStyleFlags2" }, + { + "name": "RootViewRef" + }, { "name": "RuntimeError" }, @@ -596,6 +599,9 @@ { "name": "detectChangesInViewIfAttached" }, + { + "name": "detectChangesInternal" + }, { "name": "diPublicInInjector" }, diff --git a/packages/core/test/bundling/todo/bundle.golden_symbols.json b/packages/core/test/bundling/todo/bundle.golden_symbols.json index 0ba233c5ce454..6e88fdcd4208a 100644 --- a/packages/core/test/bundling/todo/bundle.golden_symbols.json +++ b/packages/core/test/bundling/todo/bundle.golden_symbols.json @@ -395,6 +395,9 @@ { "name": "RendererStyleFlags2" }, + { + "name": "RootViewRef" + }, { "name": "RuntimeError" }, @@ -794,6 +797,9 @@ { "name": "detectChangesInViewIfAttached" }, + { + "name": "detectChangesInternal" + }, { "name": "diPublicInInjector" },