From fc52286bfa9e256e97941a06b7df0d5c7adac9af Mon Sep 17 00:00:00 2001 From: Noach Magedman Date: Wed, 5 May 2021 19:02:26 +0300 Subject: [PATCH] [FIX] Connecting stream listener not being cleared (#3008) Co-authored-by: Diego Mello --- app/lib/rocketchat.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/lib/rocketchat.js b/app/lib/rocketchat.js index fc73e375f..3d8c50b7c 100644 --- a/app/lib/rocketchat.js +++ b/app/lib/rocketchat.js @@ -196,6 +196,10 @@ const RocketChat = { clearTimeout(this.connectTimeout); } + if (this.connectingListener) { + this.connectingListener.then(this.stopListener); + } + if (this.connectedListener) { this.connectedListener.then(this.stopListener); } @@ -243,7 +247,7 @@ const RocketChat = { sdkConnect(); - this.connectedListener = this.sdk.onStreamData('connecting', () => { + this.connectingListener = this.sdk.onStreamData('connecting', () => { reduxStore.dispatch(connectRequest()); });