fix(ivy): don't throw in i18nAttributes when a component is re-rendered (#27911)

`i18nAttributes` was throwing an error when it was called multiple times in the create part of the template function with the same index, for example when we create multiple components with the same template. It shouldn't throw in this case, and just use the cache when available.

FW-903 #resolve
PR Close #27911
This commit is contained in:
Olivier Combe
2019-01-03 16:07:00 +01:00
committed by Kara Erickson
parent 7db05c408c
commit e6ab55daa0
2 changed files with 17 additions and 3 deletions

View File

@ -834,9 +834,6 @@ export function i18n(index: number, message: string, subTemplateIndex?: number):
export function i18nAttributes(index: number, values: string[]): void {
const tView = getLView()[TVIEW];
ngDevMode && assertDefined(tView, `tView should be defined`);
ngDevMode &&
assertEqual(
tView.firstTemplatePass, true, `You should only call i18nEnd on first template pass`);
if (tView.firstTemplatePass && tView.data[index + HEADER_OFFSET] === null) {
i18nAttributesFirstPass(tView, index, values);
}