[FIX] Sometimes SDK is null when try to connect (#2131)

Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
Djorkaeff Alexandre 2020-05-18 14:55:53 -03:00 committed by GitHub
parent 6152da4d6c
commit a4914d73cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 6 deletions

View File

@ -225,13 +225,12 @@ const RocketChat = {
.catch((err) => { .catch((err) => {
console.log('connect error', err); console.log('connect error', err);
const { server: currentServer } = reduxStore.getState().server; // when `connect` raises an error, we try again in 10 seconds
if (server === currentServer) { this.connectTimeout = setTimeout(() => {
// when `connect` raises an error, we try again in 10 seconds if (this.sdk?.client?.host === server) {
this.connectTimeout = setTimeout(() => {
sdkConnect(); sdkConnect();
}, 10000); }
} }, 10000);
}); });
sdkConnect(); sdkConnect();