fix(filmstrip) Fix stage filmstrip (#12209)
Use new settings action to determine when max has been reduced
This commit is contained in:
parent
63b6b5a72d
commit
dd4d49a591
|
@ -25,7 +25,6 @@ import {
|
|||
CLEAR_STAGE_PARTICIPANTS,
|
||||
REMOVE_STAGE_PARTICIPANT,
|
||||
RESIZE_FILMSTRIP,
|
||||
SET_MAX_STAGE_PARTICIPANTS,
|
||||
SET_USER_FILMSTRIP_WIDTH,
|
||||
TOGGLE_PIN_STAGE_PARTICIPANT
|
||||
} from './actionTypes';
|
||||
|
@ -137,6 +136,19 @@ MiddlewareRegistry.register(store => next => action => {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (action.settings?.maxStageParticipants !== undefined) {
|
||||
const maxParticipants = action.settings.maxStageParticipants;
|
||||
const { activeParticipants } = store.getState()['features/filmstrip'];
|
||||
const newMax = Math.min(MAX_ACTIVE_PARTICIPANTS, maxParticipants);
|
||||
|
||||
if (newMax < activeParticipants.length) {
|
||||
const toRemove = activeParticipants.slice(0, activeParticipants.length - newMax);
|
||||
|
||||
batch(() => {
|
||||
toRemove.forEach(p => store.dispatch(removeStageParticipant(p.participantId)));
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SET_USER_FILMSTRIP_WIDTH: {
|
||||
|
@ -265,22 +277,6 @@ MiddlewareRegistry.register(store => next => action => {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case SET_MAX_STAGE_PARTICIPANTS: {
|
||||
const { maxParticipants } = action;
|
||||
const { activeParticipants } = store.getState()['features/filmstrip'];
|
||||
const newMax = Math.min(MAX_ACTIVE_PARTICIPANTS, maxParticipants);
|
||||
|
||||
action.maxParticipants = newMax;
|
||||
|
||||
if (newMax < activeParticipants.length) {
|
||||
const toRemove = activeParticipants.slice(0, activeParticipants.length - newMax);
|
||||
|
||||
batch(() => {
|
||||
toRemove.forEach(p => store.dispatch(removeStageParticipant(p.participantId)));
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TOGGLE_PIN_STAGE_PARTICIPANT: {
|
||||
const { dispatch, getState } = store;
|
||||
const state = getState();
|
||||
|
|
Loading…
Reference in New Issue