Skip to content

Commit

Permalink
fix: loading stories immutable
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Jan 7, 2021
1 parent 096a8e1 commit 3844289
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions core/store/src/serialization/load-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,24 +83,24 @@ export const loadStore = (store: LoadingStore, building?: boolean): Store => {
doc,
building,
);
stories.forEach(story => {
story.id = story.id || story.name;
//storybook compat
story.controls = story.controls || (story as any).args;
Object.assign(story, deepMerge(docStoryProps, story));
story.controls = getControls(story, doc, loadedComponents);
if (doc.title && story.id) {
const id = docStoryToId(doc.title, story.id);
stories.forEach(docStory => {
const id = docStory.id || docStory.name;
if (doc.title && id) {
const story = {
...docStory,
id: docStoryToId(doc.title, id),
name: storyNameFromExport(docStory.name),
doc: doc.title,
};
//storybook compat
story.controls = story.controls || (story as any).args;
Object.assign(story, deepMerge(docStoryProps, story));
story.controls = getControls(story, doc, loadedComponents);
if (!doc.stories) {
doc.stories = [];
}
doc.stories.push(id);
globalStore.stories[id] = {
...story,
name: storyNameFromExport(story.name),
id,
doc: doc.title,
};
doc.stories.push(story.id);
globalStore.stories[story.id] = story;
}
});
});
Expand Down

0 comments on commit 3844289

Please sign in to comment.