fix(ivy): trigger directive inputs for each template creation (#30870)
A directive input that doesn't use a binding is triggered during the creation phase. But this was only executed at the first template pass, and not on subsequent ones. Now only the creation of the update instruction is executed on the first template pass, anything else is executed every time a template is created. FW-1361 #resolve PR Close #30870
This commit is contained in:

committed by
Miško Hevery

parent
f440bd1793
commit
b4b7af86c2
@ -958,9 +958,7 @@ export function ɵɵi18n(index: number, message: string, subTemplateIndex?: numb
|
||||
export function ɵɵi18nAttributes(index: number, values: string[]): void {
|
||||
const tView = getLView()[TVIEW];
|
||||
ngDevMode && assertDefined(tView, `tView should be defined`);
|
||||
if (tView.firstTemplatePass && tView.data[index + HEADER_OFFSET] === null) {
|
||||
i18nAttributesFirstPass(tView, index, values);
|
||||
}
|
||||
i18nAttributesFirstPass(tView, index, values);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -985,8 +983,10 @@ function i18nAttributesFirstPass(tView: TView, index: number, values: string[])
|
||||
// Even indexes are text (including bindings)
|
||||
const hasBinding = !!value.match(BINDING_REGEXP);
|
||||
if (hasBinding) {
|
||||
addAllToArray(
|
||||
generateBindingUpdateOpCodes(value, previousElementIndex, attrName), updateOpCodes);
|
||||
if (tView.firstTemplatePass && tView.data[index + HEADER_OFFSET] === null) {
|
||||
addAllToArray(
|
||||
generateBindingUpdateOpCodes(value, previousElementIndex, attrName), updateOpCodes);
|
||||
}
|
||||
} else {
|
||||
const lView = getLView();
|
||||
elementAttributeInternal(previousElementIndex, attrName, value, lView);
|
||||
@ -1001,7 +1001,9 @@ function i18nAttributesFirstPass(tView: TView, index: number, values: string[])
|
||||
}
|
||||
}
|
||||
|
||||
tView.data[index + HEADER_OFFSET] = updateOpCodes;
|
||||
if (tView.firstTemplatePass && tView.data[index + HEADER_OFFSET] === null) {
|
||||
tView.data[index + HEADER_OFFSET] = updateOpCodes;
|
||||
}
|
||||
}
|
||||
|
||||
let changeMask = 0b0;
|
||||
|
Reference in New Issue
Block a user