Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular: Fix sourceDecorator to apply excludeDecorators flag #29069

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions code/frameworks/angular/src/client/docs/sourceDecorator.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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<AngularRenderer>)(context.args, context).template
: story.template;

let toEmit: string;

Expand Down