From ee54a606cf2f1c942fb70718f2d4428ad7b790eb Mon Sep 17 00:00:00 2001 From: stefan-schweiger Date: Wed, 14 Jul 2021 16:49:50 +0200 Subject: [PATCH 1/2] Fixed incomplete property metadata when using inheritance --- .../preview/angular-beta/utils/NgComponentAnalyzer.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/angular/src/client/preview/angular-beta/utils/NgComponentAnalyzer.ts b/app/angular/src/client/preview/angular-beta/utils/NgComponentAnalyzer.ts index 80233b875610..a1f3d51c3f13 100644 --- a/app/angular/src/client/preview/angular-beta/utils/NgComponentAnalyzer.ts +++ b/app/angular/src/client/preview/angular-beta/utils/NgComponentAnalyzer.ts @@ -107,13 +107,20 @@ export const isComponent = (component: any): component is Type => { */ export const getComponentPropsDecoratorMetadata = (component: any) => { const decoratorKey = '__prop__metadata__'; - const propsDecorators: Record = + let propsDecorators: Record = Reflect && Reflect.getOwnPropertyDescriptor && Reflect.getOwnPropertyDescriptor(component, decoratorKey) ? Reflect.getOwnPropertyDescriptor(component, decoratorKey).value : component[decoratorKey]; + const parent = Reflect && Reflect.getPrototypeOf && Reflect.getPrototypeOf(component); + + if (parent) { + const parentPropsDecorators = getComponentPropsDecoratorMetadata(parent); + propsDecorators = { ...parentPropsDecorators, ...propsDecorators }; + } + return propsDecorators; }; From e1963b1eb4812746625082450ca591aba7566da2 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Wed, 28 Jul 2021 22:21:11 +0800 Subject: [PATCH 2/2] Update inheritance.stories.storyshot --- .../__snapshots__/inheritance.stories.storyshot | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/angular-cli/src/stories/basics/component-with-inheritance/__snapshots__/inheritance.stories.storyshot b/examples/angular-cli/src/stories/basics/component-with-inheritance/__snapshots__/inheritance.stories.storyshot index 8bae8186a796..599db9b491d9 100644 --- a/examples/angular-cli/src/stories/basics/component-with-inheritance/__snapshots__/inheritance.stories.storyshot +++ b/examples/angular-cli/src/stories/basics/component-with-inheritance/__snapshots__/inheritance.stories.storyshot @@ -16,6 +16,7 @@ exports[`Storyshots Basics / Component / With Inheritance icon button 1`] = `