From 13e12da94960c115cacfd85eef9ccce3f4bf643b Mon Sep 17 00:00:00 2001 From: Gytis Vinclovas Date: Tue, 4 Jul 2017 17:57:56 +0300 Subject: [PATCH 1/2] Remove check for sender. --- lib/channels/src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/channels/src/index.js b/lib/channels/src/index.js index fd7a3c9ae1fb..defa6aff9c5c 100644 --- a/lib/channels/src/index.js +++ b/lib/channels/src/index.js @@ -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)); } } From 8ca620b8e0f87e88007a6584a16c8a2773888a67 Mon Sep 17 00:00:00 2001 From: Gytis Vinclovas Date: Wed, 5 Jul 2017 16:03:46 +0300 Subject: [PATCH 2/2] Fixed test. --- lib/channels/src/index.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/channels/src/index.test.js b/lib/channels/src/index.test.js index 987edb2f6829..5f7e37354754 100644 --- a/lib/channels/src/index.test.js +++ b/lib/channels/src/index.test.js @@ -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]); }); }); });