Better handling of reconnect. Clear the state properly and handle spotlights.

This commit is contained in:
Håvar Aambø Fosstveit
2020-05-08 22:01:28 +02:00
parent d09e7f5565
commit 717c0053e5
8 changed files with 49 additions and 13 deletions
+5
View File
@@ -110,6 +110,11 @@ const consumers = (state = initialState, action) =>
return { ...state, [consumerId]: newConsumer };
}
case 'CLEAR_CONSUMERS':
{
return initialState;
}
default:
return state;
}
+9 -2
View File
@@ -1,4 +1,6 @@
const peer = (state = {}, action) =>
const initialState = {};
const peer = (state = initialState, action) =>
{
switch (action.type)
{
@@ -85,7 +87,7 @@ const peer = (state = {}, action) =>
}
};
const peers = (state = {}, action) =>
const peers = (state = initialState, action) =>
{
switch (action.type)
{
@@ -139,6 +141,11 @@ const peers = (state = {}, action) =>
return { ...state, [oldPeer.id]: peer(oldPeer, action) };
}
case 'CLEAR_PEERS':
{
return initialState;
}
default:
return state;
}
+5
View File
@@ -212,6 +212,11 @@ const room = (state = initialState, action) =>
return { ...state, spotlights };
}
case 'CLEAR_SPOTLIGHTS':
{
return { ...state, spotlights: [] };
}
case 'SET_LOBBY_PEERS_PROMOTION_IN_PROGRESS':
return { ...state, lobbyPeersPromotionInProgress: action.payload.flag };