From d157bae2baa30ea5292889e0abc0bcee172a5322 Mon Sep 17 00:00:00 2001 From: atanasster Date: Thu, 3 Dec 2020 14:00:38 -0500 Subject: [PATCH] fix: decorators typecheck at loading --- core/store/src/serialization/load-store.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/store/src/serialization/load-store.ts b/core/store/src/serialization/load-store.ts index 430c6bdff..c93c971a4 100644 --- a/core/store/src/serialization/load-store.ts +++ b/core/store/src/serialization/load-store.ts @@ -69,7 +69,9 @@ export const loadStore = (store: LoadingStore, building?: boolean): Store => { subcomponents: doc.subcomponents, controls: doc.controls, smartControls: doc.smartControls, - decorators: doc.decorators, + decorators: Array.isArray(doc.decorators) + ? doc.decorators.filter(d => typeof d === 'function') + : undefined, }; globalStore.docs[doc.title] = doc; Object.keys(storeStories).forEach((storyName: string) => { @@ -83,9 +85,7 @@ export const loadStore = (store: LoadingStore, building?: boolean): Store => { story.id = story.id || story.name; //storybook compat story.controls = story.controls || (story as any).args; - if (!building) { - Object.assign(story, deepMerge(docStoryProps, story)); - } + Object.assign(story, deepMerge(docStoryProps, story)); story.controls = getControls(story, doc, loadedComponents); if (doc.title && story.id) { const id = docStoryToId(doc.title, story.id);