Skip to content

Commit

Permalink
Merge pull request #1716 from storybooks/revert-1481-fixes-877
Browse files Browse the repository at this point in the history
Revert "Improved error checking in global addDecorator"
  • Loading branch information
ndelangen authored Aug 23, 2017
2 parents 5ee5038 + 743fb3b commit 6f7d8f3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
6 changes: 0 additions & 6 deletions app/react/src/client/preview/client_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export default class ClientApi {
this._storyStore = storyStore;
this._addons = {};
this._globalDecorators = [];
this._storiesAdded = false;
}

setAddon(addon) {
Expand All @@ -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);
}

Expand Down Expand Up @@ -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.`);
}
Expand Down
10 changes: 0 additions & 10 deletions app/react/src/client/preview/client_api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down

0 comments on commit 6f7d8f3

Please sign in to comment.