fix(conference): Make sure join waits for confernce.init.

It was possible that join can be executed before conference.init have even started or we haven't reached the point ot create the initialGUMPromise. This was causing the following issues:
 - users stuck on the prejoin screen
 - participants join 2+ times in the call (we have been creating more than 1 local participants from a single page).
This commit is contained in:
Hristo Terezov
2024-10-25 10:28:31 -05:00
parent 390431f4d0
commit 960a08c066
9 changed files with 112 additions and 79 deletions

View File

@@ -104,12 +104,24 @@ interface IProps extends AbstractProps, WithTranslation {
/**
* If visitors queue page is visible or not.
* NOTE: This should be set to true once we received an error on connect. Before the first connect this will always
* be false.
*/
_showVisitorsQueue: boolean;
dispatch: IStore['dispatch'];
}
/**
* Returns true if the prejoin screen should be displayed and false otherwise.
*
* @param {IProps} props - The props object.
* @returns {boolean} - True if the prejoin screen should be displayed and false otherwise.
*/
function shouldShowPrejoin({ _showPrejoin, _showVisitorsQueue }: IProps) {
return _showPrejoin && !_showVisitorsQueue;
}
/**
* The conference page of the Web application.
*/
@@ -265,7 +277,7 @@ class Conference extends AbstractConference<IProps, any> {
<CalleeInfoContainer />
{ (_showPrejoin && !_showVisitorsQueue) && <Prejoin />}
{ shouldShowPrejoin(this.props) && <Prejoin />}
{ (_showLobby && !_showVisitorsQueue) && <LobbyScreen />}
{ _showVisitorsQueue && <VisitorsQueue />}
</div>
@@ -384,7 +396,9 @@ class Conference extends AbstractConference<IProps, any> {
const { dispatch, t } = this.props;
dispatch(init());
// if we will be showing prejoin we don't want to call connect from init.
// Connect will be dispatched from prejoin screen.
dispatch(init(!shouldShowPrejoin(this.props)));
maybeShowSuboptimalExperienceNotification(dispatch, t);
}