fix(ivy): ensure renderer begin/end methods are only called during change detection (#28192)

In VE the renderer.begin() and renderer.end() methods are only called
when CD is called on an element. This patch ensures that Ivy does the
same thing.

Jira issue: FW-945

PR Close #28192
This commit is contained in:
Matias Niemelä
2019-01-16 12:22:10 -08:00
committed by Alex Rickabaugh
parent 1f7d3b9a57
commit 896cf35afb
4 changed files with 45 additions and 49 deletions

View File

@ -169,8 +169,6 @@ export class ComponentFactory<T> extends viewEngine_ComponentFactory<T> {
let component: T;
let tElementNode: TElementNode;
try {
if (rendererFactory.begin) rendererFactory.begin();
const componentView = createRootComponentView(
hostRNode, this.componentDef, rootLView, rendererFactory, renderer);
@ -216,7 +214,6 @@ export class ComponentFactory<T> extends viewEngine_ComponentFactory<T> {
refreshDescendantViews(rootLView);
} finally {
leaveView(oldLView);
if (rendererFactory.end) rendererFactory.end();
}
const componentRef = new ComponentRef(

View File

@ -395,12 +395,13 @@ function renderComponentOrTemplate<T>(
const rendererFactory = hostView[RENDERER_FACTORY];
const oldView = enterView(hostView, hostView[HOST_NODE]);
const normalExecutionPath = !getCheckNoChangesMode();
const creationModeIsActive = isCreationMode(hostView);
try {
if (normalExecutionPath && rendererFactory.begin) {
if (normalExecutionPath && !creationModeIsActive && rendererFactory.begin) {
rendererFactory.begin();
}
if (isCreationMode(hostView)) {
if (creationModeIsActive) {
// creation mode pass
if (templateFn) {
namespaceHTML();
@ -415,7 +416,7 @@ function renderComponentOrTemplate<T>(
templateFn && templateFn(RenderFlags.Update, context !);
refreshDescendantViews(hostView);
} finally {
if (normalExecutionPath && rendererFactory.end) {
if (normalExecutionPath && !creationModeIsActive && rendererFactory.end) {
rendererFactory.end();
}
leaveView(oldView);