From a7160d8c6c3c7bbe1723ed4dbe23b71fdf1b0335 Mon Sep 17 00:00:00 2001 From: damencho Date: Tue, 16 Jan 2024 12:54:34 -0600 Subject: [PATCH] fix: Fixes leaving the visitor's meeting on promotion. This was resulting some colibri websockets reconnects as the state of the previous JitsiConference was not cleaned up. --- react/features/base/conference/actions.ts | 5 +---- react/features/base/connection/actions.any.ts | 5 +++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/react/features/base/conference/actions.ts b/react/features/base/conference/actions.ts index 9873edec5722..2d98a9f351b0 100644 --- a/react/features/base/conference/actions.ts +++ b/react/features/base/conference/actions.ts @@ -1000,8 +1000,6 @@ export function setAssumedBandwidthBps(assumedBandwidthBps: number) { */ export function redirect(vnode: string, focusJid: string, username: string) { return (dispatch: IStore['dispatch'], getState: IStore['getState']) => { - const { conference, joining } = getState()['features/base/conference']; - const currentConference = conference || joining; const newConfig = getVisitorOptions(getState, vnode, focusJid, username); if (!newConfig) { @@ -1011,8 +1009,7 @@ export function redirect(vnode: string, focusJid: string, username: string) { } dispatch(overwriteConfig(newConfig)) // @ts-ignore - .then(() => currentConference && dispatch(conferenceWillLeave(currentConference, true))) - .then(() => dispatch(disconnect())) + .then(() => dispatch(disconnect(true))) .then(() => dispatch(setIAmVisitor(Boolean(vnode)))) // we do not clear local tracks on error, so we need to manually clear them diff --git a/react/features/base/connection/actions.any.ts b/react/features/base/connection/actions.any.ts index aa62450598fa..be862a141a4f 100644 --- a/react/features/base/connection/actions.any.ts +++ b/react/features/base/connection/actions.any.ts @@ -328,10 +328,11 @@ function _connectionWillConnect(connection: Object) { /** * Closes connection. + * @param {boolean} isRedirect - Indicates if the action has been dispatched as part of visitor promotion. * * @returns {Function} */ -export function disconnect() { +export function disconnect(isRedirect?: boolean) { return (dispatch: IStore['dispatch'], getState: IStore['getState']): Promise => { const state = getState(); @@ -348,7 +349,7 @@ export function disconnect() { // (and the respective Redux action) which is fired after the // conference has been left, notify the application about the // intention to leave the conference. - dispatch(conferenceWillLeave(conference_)); + dispatch(conferenceWillLeave(conference_, isRedirect)); promise = conference_.leave()