From 6f19cac299d25ab3d935124c341522d05cf18923 Mon Sep 17 00:00:00 2001 From: Michael Cebrian Date: Sat, 7 Sep 2024 06:02:59 -0400 Subject: [PATCH] Fix Angular sourceDecorator to apply excludeDecorators flag --- .../frameworks/angular/src/client/docs/sourceDecorator.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/code/frameworks/angular/src/client/docs/sourceDecorator.ts b/code/frameworks/angular/src/client/docs/sourceDecorator.ts index cd3335c8efa2..cbd3f838b340 100644 --- a/code/frameworks/angular/src/client/docs/sourceDecorator.ts +++ b/code/frameworks/angular/src/client/docs/sourceDecorator.ts @@ -1,6 +1,6 @@ import { SNIPPET_RENDERED, SourceType } from 'storybook/internal/docs-tools'; import { addons, useEffect } from 'storybook/internal/preview-api'; -import { PartialStoryFn } from 'storybook/internal/types'; +import { ArgsStoryFn, PartialStoryFn } from 'storybook/internal/types'; import { computesTemplateSourceFromComponent } from '../../renderer'; import { AngularRenderer, StoryContext } from '../types'; @@ -32,9 +32,11 @@ export const sourceDecorator = ( return story; } const channel = addons.getChannel(); - const { props, template, userDefinedTemplate } = story; - + const { props, userDefinedTemplate } = story; const { component, argTypes, parameters } = context; + const template: string = parameters.docs?.source?.excludeDecorators + ? (context.originalStoryFn as ArgsStoryFn)(context.args, context).template + : story.template; let toEmit: string;