From fb9c271fa4cdeb47c6c7e53b031c5850f0d3d2d5 Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Fri, 23 Feb 2024 08:53:14 -0300 Subject: [PATCH] fix: floating promises and fork usage on login saga (#5589) --- app/lib/methods/getCustomEmojis.ts | 2 ++ app/lib/methods/getSlashCommands.ts | 1 + app/sagas/login.js | 6 +----- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/lib/methods/getCustomEmojis.ts b/app/lib/methods/getCustomEmojis.ts index 50c3289d7..3debe7d5a 100644 --- a/app/lib/methods/getCustomEmojis.ts +++ b/app/lib/methods/getCustomEmojis.ts @@ -146,6 +146,8 @@ export function getCustomEmojis() { if (changedEmojis) { setCustomEmojis(); } + + return resolve(); } catch (e) { log(e); return resolve(); diff --git a/app/lib/methods/getSlashCommands.ts b/app/lib/methods/getSlashCommands.ts index efb996a90..41d7550ed 100644 --- a/app/lib/methods/getSlashCommands.ts +++ b/app/lib/methods/getSlashCommands.ts @@ -70,6 +70,7 @@ export function getSlashCommands() { return allRecords.length; }); } + return resolve(); } catch (e) { log(e); return resolve(); diff --git a/app/sagas/login.js b/app/sagas/login.js index e1fa2b549..233326991 100644 --- a/app/sagas/login.js +++ b/app/sagas/login.js @@ -168,10 +168,6 @@ const fetchEnterpriseModulesFork = function* fetchEnterpriseModulesFork({ user } } }; -const fetchRoomsFork = function* fetchRoomsFork() { - yield put(roomsRequest()); -}; - const fetchUsersRoles = function* fetchRoomsFork() { const roles = yield Services.getUsersRoles(); if (roles.length) { @@ -184,7 +180,7 @@ const handleLoginSuccess = function* handleLoginSuccess({ user }) { getUserPresence(user.id); const server = yield select(getServer); - yield fork(fetchRoomsFork); + yield put(roomsRequest()); yield fork(fetchPermissionsFork); yield fork(fetchCustomEmojisFork); yield fork(fetchRolesFork);