Skip to content

Commit

Permalink
fix: add isMDXComponent check
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Apr 4, 2021
1 parent a7e4896 commit 324d190
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion core/instrument/src/babel/mdx-stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ export const extractMDXStories: (
return attrComponents.length > 0 ? attrComponents[0] : undefined;
};
const { title, name, ...rest } = props;
const doc = props ? { ...rest, title: title || name } : undefined;
const doc = props
? { isMDXComponent: true, ...rest, title: title || name }
: undefined;
const store: PartialStore = {
stories: {},
doc,
Expand Down
2 changes: 1 addition & 1 deletion plugins/cc-cli/src/document-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const createDocumentTemplate: TemplateFunction<StoryTemplateOptions> = as
}));
}
}
if (stories.length <= 0 || doc.MDXPage) {
if (stories.length === 0 || doc.isMDXComponent) {
return '';
}
const store = bundle ? 'bundle' : 'imports';
Expand Down
2 changes: 1 addition & 1 deletion plugins/cc-cli/src/stories-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const createStoriesTemplate: TemplateFunction<StoryTemplateOptions> = asy
}));
}
}
if (stories.length <= 0 || doc.MDXPage) {
if (stories.length === 0 || doc.isMDXComponent) {
return '';
}
const store = bundle ? 'bundle' : 'imports';
Expand Down

0 comments on commit 324d190

Please sign in to comment.