Skip to content

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

Simplify Redux reducer source code

Lyubomir Marinov4571a4c04846
diff --git a/react/features/largeVideo/reducer.js b/react/features/largeVideo/reducer.js
index 232f44cf9e..a0d9ec1196 100644
--- a/react/features/largeVideo/reducer.js
+++ b/react/features/largeVideo/reducer.js
@@ -3,35 +3,29 @@ import { ReducerRegistry } from '../base/redux';
import { LARGE_VIDEO_PARTICIPANT_CHANGED } from './actionTypes';
-const INITIAL_STATE = {
- participantId: undefined
-};
+ReducerRegistry.register('features/largeVideo', (state = {}, action) => {
+ switch (action.type) {
-ReducerRegistry.register(
- 'features/largeVideo',
- (state = INITIAL_STATE, action) => {
- switch (action.type) {
-
- // When conference is joined, we update ID of local participant from
- // default 'local' to real ID. However, in large video we might have
- // already selected 'local' as participant on stage. So in this case we
- // must update ID of participant on stage to match ID in 'participants'
- // state to avoid additional changes in state and (re)renders.
- case PARTICIPANT_ID_CHANGED:
- if (state.participantId === action.oldValue) {
- return {
- ...state,
- participantId: action.newValue
- };
- }
- break;
-
- case LARGE_VIDEO_PARTICIPANT_CHANGED:
+ // When conference is joined, we update ID of local participant from default
+ // 'local' to real ID. However, in large video we might have already
+ // selected 'local' as participant on stage. So in this case we must update
+ // ID of participant on stage to match ID in 'participants' state to avoid
+ // additional changes in state and (re)renders.
+ case PARTICIPANT_ID_CHANGED:
+ if (state.participantId === action.oldValue) {
return {
...state,
- participantId: action.participantId
+ participantId: action.newValue
};
}
+ break;
+
+ case LARGE_VIDEO_PARTICIPANT_CHANGED:
+ return {
+ ...state,
+ participantId: action.participantId
+ };
+ }
- return state;
- });
+ return state;
+});