Skip to content

Commit

Permalink
Merge pull request #1407 from storybooks/addons-channel-disable-owner…
Browse files Browse the repository at this point in the history
…-check

Remove check for sender on channel.
  • Loading branch information
ndelangen authored Aug 28, 2017
2 parents c0e468a + 3cc763b commit a1e6ab7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/channels/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default class Channel {

_handleEvent(event) {
const listeners = this._listeners[event.type];
if (event.from !== this._sender && listeners) {
if (listeners) {
listeners.forEach(fn => fn(...event.args));
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/channels/src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ describe('Channel', () => {
});

describe('_miscellaneous', () => {
it('should ignore if event came from itself', () => {
it('should not ignore if event came from itself', () => {
const received = [];
channel.on('type-1', n => received.push(n));
channel._handleEvent({ type: 'type-1', args: [11] });
channel._handleEvent({ type: 'type-1', args: [12], from: channel._sender });
expect(received).toEqual([11]);
expect(received).toEqual([11, 12]);
});
});
});

0 comments on commit a1e6ab7

Please sign in to comment.