From 0d1a153f5381656467fe4845a9cd2e2cc50b89f0 Mon Sep 17 00:00:00 2001 From: Jibon Date: Mon, 16 Sep 2024 17:36:32 +0200 Subject: [PATCH] update breakout room lists instantly after end --- package.json | 2 +- pnpm-lock.yaml | 10 +++---- src/helpers/nats/ConnectNats.ts | 3 ++- src/helpers/nats/HandleSystemData.tsx | 38 +++++++++++++++++---------- 4 files changed, 32 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index f076db89..b7431198 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "microsoft-cognitiveservices-speech-sdk": "1.40.0", "mobile-detect": "1.4.5", "nosleep.js": "0.12.0", - "plugnmeet-protocol-js": "1.0.5-rc.14", + "plugnmeet-protocol-js": "1.0.5-rc.15", "react": "18.3.1", "react-cool-virtual": "0.7.0", "react-dnd": "16.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c5bf1cc4..10d0da7c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -69,8 +69,8 @@ importers: specifier: 0.12.0 version: 0.12.0 plugnmeet-protocol-js: - specifier: 1.0.5-rc.14 - version: 1.0.5-rc.14 + specifier: 1.0.5-rc.15 + version: 1.0.5-rc.15 react: specifier: 18.3.1 version: 18.3.1 @@ -3087,8 +3087,8 @@ packages: resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} engines: {node: '>=8'} - plugnmeet-protocol-js@1.0.5-rc.14: - resolution: {integrity: sha512-rD83gs5WPE9dqknJZuuCNj0JlOWpXCsbHcft5FlpZ1nDGpUQj9G1WooOb7NRm/XCyWloW6Phbgrb94n0DXBPkg==} + plugnmeet-protocol-js@1.0.5-rc.15: + resolution: {integrity: sha512-fOwmfh/E85r1KmA/MRAcfVuGU4gvwydZgD2tAU28Ec6wstrcPAx7lVSVzkX3aI9BIff2bXgMjqotciSunEHJ7A==} possible-typed-array-names@1.0.0: resolution: {integrity: sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==} @@ -7503,7 +7503,7 @@ snapshots: dependencies: find-up: 4.1.0 - plugnmeet-protocol-js@1.0.5-rc.14: + plugnmeet-protocol-js@1.0.5-rc.15: dependencies: '@bufbuild/protobuf': 2.0.0 diff --git a/src/helpers/nats/ConnectNats.ts b/src/helpers/nats/ConnectNats.ts index 2883d10c..25be5d96 100644 --- a/src/helpers/nats/ConnectNats.ts +++ b/src/helpers/nats/ConnectNats.ts @@ -569,7 +569,8 @@ export default class ConnectNats { this.handleSystemData.handlePoll(payload); break; case NatsMsgServerToClientEvents.JOIN_BREAKOUT_ROOM: - this.handleSystemData.handleBreakoutRoomNotifications(payload.msg); + case NatsMsgServerToClientEvents.BREAKOUT_ROOM_ENDED: + this.handleSystemData.handleBreakoutRoom(payload); break; case NatsMsgServerToClientEvents.SYSTEM_CHAT_MSG: this.handleSystemData.handleSysChatMsg(payload.msg); diff --git a/src/helpers/nats/HandleSystemData.tsx b/src/helpers/nats/HandleSystemData.tsx index 36de5ee5..fcbe3124 100644 --- a/src/helpers/nats/HandleSystemData.tsx +++ b/src/helpers/nats/HandleSystemData.tsx @@ -86,24 +86,34 @@ export default class HandleSystemData { }; public handlePoll = (payload: NatsMsgServerToClient) => { - if (payload.event === NatsMsgServerToClientEvents.POLL_CREATED) { - toast(, { - toastId: 'info-status', - type: 'info', - autoClose: false, - }); - store.dispatch(pollsApi.util.invalidateTags(['List', 'PollsStats'])); - } else if (payload.event === NatsMsgServerToClientEvents.POLL_CLOSED) { - store.dispatch(pollsApi.util.invalidateTags(['List', 'PollsStats'])); + switch (payload.event) { + case NatsMsgServerToClientEvents.POLL_CREATED: + toast(, { + toastId: 'info-status', + type: 'info', + autoClose: false, + }); + store.dispatch(pollsApi.util.invalidateTags(['List', 'PollsStats'])); + break; + case NatsMsgServerToClientEvents.POLL_CLOSED: + store.dispatch(pollsApi.util.invalidateTags(['List', 'PollsStats'])); + break; } }; - public handleBreakoutRoomNotifications = (msg: string) => { - if (msg === '') { - return; + public handleBreakoutRoom = (payload: NatsMsgServerToClient) => { + switch (payload.event) { + case NatsMsgServerToClientEvents.JOIN_BREAKOUT_ROOM: + if (payload.msg !== '') { + store.dispatch(updateReceivedInvitationFor(payload.msg)); + store.dispatch(breakoutRoomApi.util.invalidateTags(['My_Rooms'])); + } + break; + case NatsMsgServerToClientEvents.BREAKOUT_ROOM_ENDED: + store.dispatch(breakoutRoomApi.util.invalidateTags(['List'])); + store.dispatch(breakoutRoomApi.util.invalidateTags(['My_Rooms'])); + break; } - store.dispatch(updateReceivedInvitationFor(msg)); - store.dispatch(breakoutRoomApi.util.invalidateTags(['My_Rooms'])); }; public handleSysChatMsg = (msg: string) => {