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.
This commit is contained in:
Tom Coleman 2020-07-06 16:38:11 +10:00
parent 40a319d367
commit 63fec28021
4 changed files with 0 additions and 23 deletions

View File

@ -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 = <StoryFnReturnType = unknown>(
kind: string,

View File

@ -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());
}
}
};
}

View File

@ -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] = {

View File

@ -1,6 +1,3 @@
import { configure } from '@storybook/{{framework}}';
// eslint-disable-next-line no-underscore-dangle
module._StorybookPreserveDecorators = true;
configure(['{{stories}}'], module);