From 63fec28021b164da9bbc9fb21736d37f09407e6d Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Mon, 6 Jul 2020 16:38:11 +1000 Subject: [PATCH] Get rid of `module.hot.accept` code for configure API. This avoids us having to solve #10005 right now and is consistent with the stories entry. --- lib/client-api/src/client_api.ts | 4 ---- lib/client-api/src/config_api.ts | 12 ------------ lib/client-api/src/story_store.ts | 4 ---- .../server/preview/virtualModuleStory.template.js | 3 --- 4 files changed, 23 deletions(-) diff --git a/lib/client-api/src/client_api.ts b/lib/client-api/src/client_api.ts index 4dde221cfd0..6791d89b39a 100644 --- a/lib/client-api/src/client_api.ts +++ b/lib/client-api/src/client_api.ts @@ -110,10 +110,6 @@ export default class ClientApi { this._storyStore.addArgTypesEnhancer(enhancer); }; - clearDecorators = () => { - this._storyStore.clearGlobalDecorators(); - }; - // what are the occasions that "m" is a boolean vs an obj storiesOf = ( kind: string, diff --git a/lib/client-api/src/config_api.ts b/lib/client-api/src/config_api.ts index 90e8967e53a..f56b6c61e6e 100644 --- a/lib/client-api/src/config_api.ts +++ b/lib/client-api/src/config_api.ts @@ -28,17 +28,5 @@ export default class ConfigApi { this._storyStore.setError(err); } this._storyStore.finishConfiguring(); - - if (module.hot) { - module.hot.accept(); - // The generated entry point for main.js:stories adds this flag as it cannot - // set decorators but calls configure, and aims not to clear decorators added by other files. - // HOWEVER: this will still clear global decorators added by addons when reloading preview.js - // which is a bug! - // @ts-ignore - if (!module._StorybookPreserveDecorators) { - module.hot.dispose(() => this._storyStore.clearGlobalDecorators()); - } - } }; } diff --git a/lib/client-api/src/story_store.ts b/lib/client-api/src/story_store.ts index 4c8d0115337..cf679ccfd7d 100644 --- a/lib/client-api/src/story_store.ts +++ b/lib/client-api/src/story_store.ts @@ -246,10 +246,6 @@ export default class StoryStore { this._globalMetadata.decorators.push(...decorators); } - clearGlobalDecorators() { - this._globalMetadata.decorators = []; - } - ensureKind(kind: string) { if (!this._kinds[kind]) { this._kinds[kind] = { diff --git a/lib/core/src/server/preview/virtualModuleStory.template.js b/lib/core/src/server/preview/virtualModuleStory.template.js index 3687c6daf83..71fd7df90d8 100644 --- a/lib/core/src/server/preview/virtualModuleStory.template.js +++ b/lib/core/src/server/preview/virtualModuleStory.template.js @@ -1,6 +1,3 @@ import { configure } from '@storybook/{{framework}}'; -// eslint-disable-next-line no-underscore-dangle -module._StorybookPreserveDecorators = true; - configure(['{{stories}}'], module);