Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

ref(initialGUMPromise): Move out of _common reducer.

Hristo Terezovd510390edc25
diff --git a/react/features/base/conference/middleware.web.ts b/react/features/base/conference/middleware.web.ts
index 29060d75c1..cf19e87a7d 100644
--- a/react/features/base/conference/middleware.web.ts
+++ b/react/features/base/conference/middleware.web.ts
@@ -138,7 +138,7 @@ MiddlewareRegistry.register(store => next => action => {
break;
case CONNECTION_DISCONNECTED: {
- const { initialGUMPromise } = getState()['features/base/media'].common;
+ const { initialGUMPromise } = getState()['features/base/media'];
if (initialGUMPromise) {
store.dispatch(setInitialGUMPromise());
@@ -150,7 +150,7 @@ MiddlewareRegistry.register(store => next => action => {
const state = getState();
if (!isPrejoinPageVisible(state)) {
- const { initialGUMPromise = Promise.resolve({ tracks: [] }) } = state['features/base/media'].common;
+ const { initialGUMPromise = Promise.resolve({ tracks: [] }) } = state['features/base/media'];
initialGUMPromise.then(({ tracks }) => {
let tracksToUse = tracks ?? [];
diff --git a/react/features/base/media/reducer.ts b/react/features/base/media/reducer.ts
index 92fed2795b..73cbbe6c52 100644
--- a/react/features/base/media/reducer.ts
+++ b/react/features/base/media/reducer.ts
@@ -88,11 +88,6 @@ function _audio(state: IAudioState = _AUDIO_INITIAL_MEDIA_STATE, action: AnyActi
}
}
-/**
- * The initial common media state.
- */
-const _COMMON_INITIAL_STATE = {};
-
/**
* Reducer fot the common properties in media state.
*
@@ -101,12 +96,9 @@ const _COMMON_INITIAL_STATE = {};
* @param {string} action.type - Type of action.
* @returns {ICommonState}
*/
-function _common(state: ICommonState = _COMMON_INITIAL_STATE, action: AnyAction) {
+function _initialGUMPromise(state: initialGUMPromise | undefined, action: AnyAction) {
if (action.type === SET_INITIAL_GUM_PROMISE) {
- return {
- ...state,
- initialGUMPromise: action.promise
- };
+ return action.promise;
}
return state;
@@ -272,12 +264,10 @@ interface IAudioState {
unmuteBlocked: boolean;
}
-interface ICommonState {
- initialGUMPromise?: Promise<{
+type initialGUMPromise = Promise<{
errors: any;
tracks: Array<any>;
- }>;
-}
+ }> | undefined;
interface IScreenshareState {
available: boolean;
@@ -296,7 +286,7 @@ interface IVideoState {
export interface IMediaState {
audio: IAudioState;
- common: ICommonState;
+ initialGUMPromise: initialGUMPromise;
screenshare: IScreenshareState;
video: IVideoState;
}
@@ -313,7 +303,7 @@ export interface IMediaState {
*/
ReducerRegistry.register<IMediaState>('features/base/media', combineReducers({
audio: _audio,
- common: _common,
+ initialGUMPromise: _initialGUMPromise,
screenshare: _screenshare,
video: _video
}));
diff --git a/react/features/prejoin/middleware.web.ts b/react/features/prejoin/middleware.web.ts
index bbe92f0428..622b58be32 100644
--- a/react/features/prejoin/middleware.web.ts
+++ b/react/features/prejoin/middleware.web.ts
@@ -37,7 +37,7 @@ MiddlewareRegistry.register(store => next => action => {
const result = next(action);
if (isPrejoinPageVisible(getState())) {
- const { initialGUMPromise = Promise.resolve() } = getState()['features/base/media'].common;
+ const { initialGUMPromise = Promise.resolve() } = getState()['features/base/media'];
initialGUMPromise.then(() => {
const state = getState();