From c9bf599bcf3b1170302761ec07c6b3d92e1906e2 Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Thu, 7 Feb 2019 18:28:39 -0200 Subject: [PATCH] [FIX] Start loop searching for rooms updates only when connection goes down and SDK has userId (#613) --- app/lib/methods/subscriptions/rooms.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app/lib/methods/subscriptions/rooms.js b/app/lib/methods/subscriptions/rooms.js index 494d50e71..84fff4a20 100644 --- a/app/lib/methods/subscriptions/rooms.js +++ b/app/lib/methods/subscriptions/rooms.js @@ -16,23 +16,21 @@ export default async function subscribeRooms() { timer = setTimeout(() => { clearTimeout(timer); timer = false; - if (this.sdk.userId) { - store.dispatch(roomsRequest()); - loop(); - } + store.dispatch(roomsRequest()); + loop(); }, 5000); }; this.sdk.onStreamData('connected', () => { - if (this.sdk.userId) { - store.dispatch(roomsRequest()); - } + store.dispatch(roomsRequest()); clearTimeout(timer); timer = false; }); this.sdk.onStreamData('close', () => { - loop(); + if (this.sdk.userId) { + loop(); + } }); this.sdk.onStreamData('stream-notify-user', protectedFunction((ddpMessage) => {