refactor(ivy): replace enter / leave view with selectView (#32263)
After a series of recent refactorings `enterView` and `leaveView` became identical. This PR merges both into one concept of view selectio (similar to a node selection). This reduces number of concepts and code size. PR Close #32263
This commit is contained in:
@ -248,9 +248,6 @@
|
||||
{
|
||||
"name": "elementCreate"
|
||||
},
|
||||
{
|
||||
"name": "enterView"
|
||||
},
|
||||
{
|
||||
"name": "executeCheckHooks"
|
||||
},
|
||||
@ -488,9 +485,6 @@
|
||||
{
|
||||
"name": "isStylingValueDefined"
|
||||
},
|
||||
{
|
||||
"name": "leaveView"
|
||||
},
|
||||
{
|
||||
"name": "locateHostElement"
|
||||
},
|
||||
@ -596,6 +590,9 @@
|
||||
{
|
||||
"name": "selectInternal"
|
||||
},
|
||||
{
|
||||
"name": "selectView"
|
||||
},
|
||||
{
|
||||
"name": "setActiveHostElement"
|
||||
},
|
||||
|
@ -206,9 +206,6 @@
|
||||
{
|
||||
"name": "domRendererFactory3"
|
||||
},
|
||||
{
|
||||
"name": "enterView"
|
||||
},
|
||||
{
|
||||
"name": "executeCheckHooks"
|
||||
},
|
||||
@ -359,9 +356,6 @@
|
||||
{
|
||||
"name": "isRootView"
|
||||
},
|
||||
{
|
||||
"name": "leaveView"
|
||||
},
|
||||
{
|
||||
"name": "locateHostElement"
|
||||
},
|
||||
@ -437,6 +431,9 @@
|
||||
{
|
||||
"name": "selectInternal"
|
||||
},
|
||||
{
|
||||
"name": "selectView"
|
||||
},
|
||||
{
|
||||
"name": "setActiveHostElement"
|
||||
},
|
||||
|
@ -629,9 +629,6 @@
|
||||
{
|
||||
"name": "elementPropertyInternal"
|
||||
},
|
||||
{
|
||||
"name": "enterView"
|
||||
},
|
||||
{
|
||||
"name": "executeCheckHooks"
|
||||
},
|
||||
@ -1058,9 +1055,6 @@
|
||||
{
|
||||
"name": "iterateListLike"
|
||||
},
|
||||
{
|
||||
"name": "leaveView"
|
||||
},
|
||||
{
|
||||
"name": "listenerInternal"
|
||||
},
|
||||
@ -1256,6 +1250,9 @@
|
||||
{
|
||||
"name": "selectInternal"
|
||||
},
|
||||
{
|
||||
"name": "selectView"
|
||||
},
|
||||
{
|
||||
"name": "setActiveHostElement"
|
||||
},
|
||||
|
@ -17,7 +17,7 @@ import {TNODE} from '../../src/render3/interfaces/injector';
|
||||
import {TNodeType} from '../../src/render3/interfaces/node';
|
||||
import {isProceduralRenderer} from '../../src/render3/interfaces/renderer';
|
||||
import {LViewFlags, TVIEW} from '../../src/render3/interfaces/view';
|
||||
import {enterView, leaveView} from '../../src/render3/state';
|
||||
import {selectView} from '../../src/render3/state';
|
||||
import {ViewRef} from '../../src/render3/view_ref';
|
||||
|
||||
import {getRendererFactory2} from './imported_renderer2';
|
||||
@ -606,7 +606,7 @@ describe('di', () => {
|
||||
const contentView = createLView(
|
||||
null, createTView(-1, null, 1, 0, null, null, null, null), null, LViewFlags.CheckAlways,
|
||||
null, null, {} as any, {} as any);
|
||||
const oldView = enterView(contentView, null);
|
||||
const oldView = selectView(contentView, null);
|
||||
try {
|
||||
const parentTNode =
|
||||
getOrCreateTNode(contentView[TVIEW], null, 0, TNodeType.Element, null, null);
|
||||
@ -618,7 +618,7 @@ describe('di', () => {
|
||||
const injector = getOrCreateNodeInjectorForNode(parentTNode, contentView);
|
||||
expect(injector).not.toEqual(-1);
|
||||
} finally {
|
||||
leaveView(oldView);
|
||||
selectView(oldView, null);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -14,7 +14,7 @@ import {ViewContainerRef} from '@angular/core/src/linker/view_container_ref';
|
||||
import {Renderer2} from '@angular/core/src/render/api';
|
||||
import {createLView, createTView, getOrCreateTNode, getOrCreateTView, renderComponentOrTemplate} from '@angular/core/src/render3/instructions/shared';
|
||||
import {TNodeType} from '@angular/core/src/render3/interfaces/node';
|
||||
import {enterView, getLView, resetComponentState} from '@angular/core/src/render3/state';
|
||||
import {getLView, resetComponentState, selectView} from '@angular/core/src/render3/state';
|
||||
import {stringifyElement} from '@angular/platform-browser/testing/src/browser_util';
|
||||
|
||||
import {SWITCH_CHANGE_DETECTOR_REF_FACTORY__POST_R3__ as R3_CHANGE_DETECTOR_REF_FACTORY} from '../../src/change_detection/change_detector_ref';
|
||||
@ -257,7 +257,7 @@ export function renderTemplate<T>(
|
||||
const hostLView = createLView(
|
||||
null, tView, {}, LViewFlags.CheckAlways | LViewFlags.IsRoot, null, null,
|
||||
providedRendererFactory, renderer);
|
||||
enterView(hostLView, null); // SUSPECT! why do we need to enter the View?
|
||||
selectView(hostLView, null); // SUSPECT! why do we need to enter the View?
|
||||
|
||||
const def: ComponentDef<any> = ɵɵdefineComponent({
|
||||
factory: () => null,
|
||||
|
Reference in New Issue
Block a user