fix(ivy): host listeners being inherited twice (#28902)

Fixes inherited host event listeners being registered twice.

This PR resolves FW-1071.

PR Close #28902
This commit is contained in:
Kristiyan Kostadinov
2019-02-21 22:45:37 +01:00
committed by Ben Lesh
parent 9dac04ff50
commit 43181ea568
4 changed files with 70 additions and 5 deletions

View File

@ -728,7 +728,7 @@ const updateBaseDefFromIOProp = (getProp: (baseDef: {inputs?: any, outputs?: any
const baseDef = constructor.ngBaseDef;
const defProp = getProp(baseDef);
defProp[name] = args[0];
defProp[name] = args[0] || name;
};
/**

View File

@ -210,6 +210,13 @@ export class ReflectionCapabilities implements PlatformReflectionCapabilities {
return propMetadata;
}
ownPropMetadata(typeOrFunc: any): {[key: string]: any[]} {
if (!isType(typeOrFunc)) {
return {};
}
return this._ownPropMetadata(typeOrFunc, Object) || {};
}
hasLifecycleHook(type: any, lcProperty: string): boolean {
return type instanceof Type && lcProperty in type.prototype;
}

View File

@ -63,7 +63,8 @@ export function compileComponent(type: Type<any>, metadata: Component): void {
preserveWhitespaces: metadata.preserveWhitespaces || false,
styles: metadata.styles || EMPTY_ARRAY,
animations: metadata.animations,
viewQueries: extractQueriesMetadata(type, getReflect().propMetadata(type), isViewQuery),
viewQueries:
extractQueriesMetadata(type, getReflect().ownPropMetadata(type), isViewQuery),
directives: [],
changeDetection: metadata.changeDetection,
pipes: new Map(),
@ -138,7 +139,7 @@ export function extendsDirectlyFromObject(type: Type<any>): boolean {
*/
function directiveMetadata(type: Type<any>, metadata: Directive): R3DirectiveMetadataFacade {
// Reflect inputs and outputs.
const propMetadata = getReflect().propMetadata(type);
const propMetadata = getReflect().ownPropMetadata(type);
return {
name: type.name,