mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-03 05:04:51 +08:00
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:
parent
40a319d367
commit
63fec28021
@ -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,
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -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] = {
|
||||
|
@ -1,6 +1,3 @@
|
||||
import { configure } from '@storybook/{{framework}}';
|
||||
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
module._StorybookPreserveDecorators = true;
|
||||
|
||||
configure(['{{stories}}'], module);
|
||||
|
Loading…
x
Reference in New Issue
Block a user