diff --git a/dist/client/preview/client_api.js b/dist/client/preview/client_api.js index c20fd4d70215..03cd26ae651e 100644 --- a/dist/client/preview/client_api.js +++ b/dist/client/preview/client_api.js @@ -52,6 +52,11 @@ var ClientApi = function () { value: function addDecorator(decorator) { this._globalDecorators.push(decorator); } + }, { + key: 'clearDecorators', + value: function clearDecorators() { + this._globalDecorators = []; + } }, { key: 'storiesOf', value: function storiesOf(kind, m) { diff --git a/dist/client/preview/config_api.js b/dist/client/preview/config_api.js index 2dbd60b49cdb..64b04680da89 100644 --- a/dist/client/preview/config_api.js +++ b/dist/client/preview/config_api.js @@ -14,6 +14,8 @@ var _createClass3 = _interopRequireDefault(_createClass2); var _actions = require('./actions'); +var _ = require('./'); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var ConfigApi = function () { @@ -67,6 +69,9 @@ var ConfigApi = function () { module.hot.accept(function () { setTimeout(render); }); + module.hot.dispose(function () { + (0, _.clearDecorators)(); + }); } render(); diff --git a/dist/client/preview/index.js b/dist/client/preview/index.js index 82965684ac77..a7667fb7b263 100644 --- a/dist/client/preview/index.js +++ b/dist/client/preview/index.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.configure = exports.addDecorator = exports.setAddon = exports.linkTo = exports.action = exports.storiesOf = undefined; +exports.configure = exports.clearDecorators = exports.addDecorator = exports.setAddon = exports.linkTo = exports.action = exports.storiesOf = undefined; require('es6-shim'); @@ -62,6 +62,7 @@ var action = exports.action = clientApi.action.bind(clientApi); var linkTo = exports.linkTo = clientApi.linkTo.bind(clientApi); var setAddon = exports.setAddon = clientApi.setAddon.bind(clientApi); var addDecorator = exports.addDecorator = clientApi.addDecorator.bind(clientApi); +var clearDecorators = exports.clearDecorators = clientApi.clearDecorators.bind(clientApi); var configure = exports.configure = configApi.configure.bind(configApi); // initialize the UI diff --git a/src/client/preview/client_api.js b/src/client/preview/client_api.js index c0afb1673a7f..fd4b42171198 100644 --- a/src/client/preview/client_api.js +++ b/src/client/preview/client_api.js @@ -19,6 +19,10 @@ export default class ClientApi { this._globalDecorators.push(decorator); } + clearDecorators() { + this._globalDecorators = []; + } + storiesOf(kind, m) { if (m && m.hot) { m.hot.dispose(() => { diff --git a/src/client/preview/config_api.js b/src/client/preview/config_api.js index a897ddc90b86..2cdf7595f0bf 100644 --- a/src/client/preview/config_api.js +++ b/src/client/preview/config_api.js @@ -4,6 +4,8 @@ import { clearError, } from './actions'; +import { clearDecorators } from './'; + export default class ConfigApi { constructor({ pageBus, storyStore, reduxStore }) { this._pageBus = pageBus; @@ -42,6 +44,9 @@ export default class ConfigApi { module.hot.accept(() => { setTimeout(render); }); + module.hot.dispose(() => { + clearDecorators(); + }); } render(); diff --git a/src/client/preview/index.js b/src/client/preview/index.js index 106ee2270026..9f4706f6b559 100644 --- a/src/client/preview/index.js +++ b/src/client/preview/index.js @@ -29,6 +29,7 @@ export const action = clientApi.action.bind(clientApi); export const linkTo = clientApi.linkTo.bind(clientApi); export const setAddon = clientApi.setAddon.bind(clientApi); export const addDecorator = clientApi.addDecorator.bind(clientApi); +export const clearDecorators = clientApi.clearDecorators.bind(clientApi); export const configure = configApi.configure.bind(configApi); // initialize the UI