fix(compiler): don't trigger duplicated directives
Fixes #2756 Closes #2568
This commit is contained in:

committed by
Tobias Bosch

parent
0b50258814
commit
0598226e24
@ -153,8 +153,8 @@ export class Compiler {
|
||||
}
|
||||
}
|
||||
|
||||
var boundDirectives =
|
||||
ListWrapper.map(directives, (directive) => this._bindDirective(directive));
|
||||
var boundDirectives = this._removeDuplicatedDirectives(
|
||||
ListWrapper.map(directives, (directive) => this._bindDirective(directive)));
|
||||
|
||||
var renderTemplate = this._buildRenderTemplate(component, view, boundDirectives);
|
||||
pvPromise =
|
||||
@ -167,6 +167,12 @@ export class Compiler {
|
||||
return pvPromise;
|
||||
}
|
||||
|
||||
private _removeDuplicatedDirectives(directives: List<DirectiveBinding>): List<DirectiveBinding> {
|
||||
var directivesMap: Map<number, DirectiveBinding> = new Map();
|
||||
directives.forEach((dirBinding) => { directivesMap.set(dirBinding.key.id, dirBinding); });
|
||||
return MapWrapper.values(directivesMap);
|
||||
}
|
||||
|
||||
private _compileNestedProtoViews(componentBinding, renderPv, directives): Promise<AppProtoView>|
|
||||
AppProtoView {
|
||||
var protoViews =
|
||||
|
Reference in New Issue
Block a user