Skip to content

Commit

Permalink
fix: Fixes leaving the visitor's meeting on promotion.
Browse files Browse the repository at this point in the history
This was resulting some colibri websockets reconnects as the state of the previous JitsiConference was not cleaned up.
  • Loading branch information
damencho committed Jan 16, 2024
1 parent 9ae5677 commit a7160d8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 1 addition & 4 deletions react/features/base/conference/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
Expand Down
5 changes: 3 additions & 2 deletions react/features/base/connection/actions.any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,11 @@ function _connectionWillConnect(connection: Object) {

/**
* Closes connection.

Check failure on line 330 in react/features/base/connection/actions.any.ts

View workflow job for this annotation

GitHub Actions / Lint

There must be a newline after the description of the JSDoc block
* @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<void> => {
const state = getState();

Expand All @@ -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()
Expand Down

0 comments on commit a7160d8

Please sign in to comment.