diff --git a/app/react/src/client/preview/client_api.js b/app/react/src/client/preview/client_api.js index cf12a4196898..b711d4e96e0c 100644 --- a/app/react/src/client/preview/client_api.js +++ b/app/react/src/client/preview/client_api.js @@ -8,7 +8,6 @@ export default class ClientApi { this._storyStore = storyStore; this._addons = {}; this._globalDecorators = []; - this._storiesAdded = false; } setAddon(addon) { @@ -19,9 +18,6 @@ export default class ClientApi { } addDecorator(decorator) { - if (this._storiesAdded) { - throw new Error('Global decorators added after loading stories will not be applied'); - } this._globalDecorators.push(decorator); } @@ -62,8 +58,6 @@ export default class ClientApi { }); api.add = (storyName, getStory) => { - this._storiesAdded = true; - if (typeof storyName !== 'string') { throw new Error(`Invalid or missing storyName provided for a "${kind}" story.`); } diff --git a/app/react/src/client/preview/client_api.test.js b/app/react/src/client/preview/client_api.test.js index da6a6bb1abb1..acb45b425c1f 100644 --- a/app/react/src/client/preview/client_api.test.js +++ b/app/react/src/client/preview/client_api.test.js @@ -150,16 +150,6 @@ describe('preview.client_api', () => { expect(storyStore.stories[0].fn()).toBe('bb-Hello'); }); - it('should throw on adding global decorators after stories', () => { - const storyStore = new StoryStore(); - const api = new ClientAPI({ storyStore }); - const localApi = api.storiesOf('none'); - localApi.add('storyName', () => 'Hello'); - expect(() => { - api.addDecorator(fn => `bb-${fn()}`); - }).toThrow('Global decorators added after loading stories will not be applied'); - }); - it('should utilize both decorators at once', () => { const storyStore = new StoryStore(); const api = new ClientAPI({ storyStore });