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:
@ -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