Skip to content

Commit

Permalink
fix: componentsLookup
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Jun 24, 2020
1 parent 7fdcd7d commit a8f0f43
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/instrument/src/babel/csf-stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export const extractCSFStories = (
});
if (store.doc) {
//@ts-ignore
store.doc.components = components;
store.doc.componentsLookup = components;
} else {
throw new Error(`stories should have one default export`);
}
Expand Down
6 changes: 3 additions & 3 deletions core/instrument/src/babel/extract-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ export const extractStoreComponent = async (
) => {
if (store.doc) {
const doc: Document = store.doc;
if (doc.components) {
const componentNames = Object.keys(doc.components);
if (doc.componentsLookup) {
const componentNames = Object.keys(doc.componentsLookup);
if (componentNames) {
for (const componentName of componentNames) {
const { component, componentPackage } = await extractComponent(
Expand All @@ -104,7 +104,7 @@ export const extractStoreComponent = async (
`${component.request ?? filePath}-${componentName}`,
);
store.components[componentKey] = component;
doc.components[componentName] = componentKey;
doc.componentsLookup[componentName] = componentKey;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions core/instrument/src/babel/mdx-stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export const extractMDXStories = (props: any) => (
const { title } = attributes;
if (title) {
const doc: Document = {
components: {},
componentsLookup: {},
...attributes,
title,
};
Expand All @@ -196,7 +196,7 @@ export const extractMDXStories = (props: any) => (

if (store.doc && store.doc.title) {
//@ts-ignore
store.doc.components = components;
store.doc.componentsLookup = components;
return store;
} else {
return undefined;
Expand Down

0 comments on commit a8f0f43

Please sign in to comment.