From ac1d779de522949db64e44f9e1cf7e522ebd5902 Mon Sep 17 00:00:00 2001 From: Akmal Isomadinov Date: Thu, 27 Jun 2024 16:45:04 +0500 Subject: [PATCH] Client:Store:SelectionPeopleStore Fixed connection list --- packages/client/src/store/SelectionPeopleStore.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/client/src/store/SelectionPeopleStore.js b/packages/client/src/store/SelectionPeopleStore.js index 9152f5018f..26f6e3d597 100644 --- a/packages/client/src/store/SelectionPeopleStore.js +++ b/packages/client/src/store/SelectionPeopleStore.js @@ -557,7 +557,13 @@ class SelectionStore { if (isCurrentSesstion) return [{ ...first, ...firstSessions }, ...other]; - if (connectionsIsEmpty) return [data?.sessions.at(-1)]; + if (connectionsIsEmpty) { + const lastSession = data?.sessions.at(-1); + + if (!lastSession) return []; + + return [lastSession]; + } return session.connections; }; @@ -568,7 +574,7 @@ class SelectionStore { return map; }, {}); - const temp = this.sessionsData.map((session) => { + const sessions = this.sessionsData.map((session) => { const data = dataFromSocketMap[session.id]; const connections = this.getCurrentConnections(session, data); @@ -576,7 +582,7 @@ class SelectionStore { return { ...data, ...session, connections }; }); - return temp; + return sessions.filter((session) => session.connections.length !== 0); } // updateAllSessions = (sessionsData, dataFromSocket, currentDataFromSocket) => {