Lots of performance fixes

This commit is contained in:
Håvar Aambø Fosstveit
2019-04-03 16:20:17 +02:00
parent 168affbc57
commit e84af94544
16 changed files with 219 additions and 117 deletions
+2 -9
View File
@@ -25,6 +25,7 @@ const consumers = (state = initialState, action) =>
{
const { consumerId, originator } = action.payload;
const consumer = state[consumerId];
let newConsumer;
if (originator === 'local')
@@ -35,19 +36,11 @@ const consumers = (state = initialState, action) =>
return { ...state, [consumerId]: newConsumer };
}
case 'SET_CONSUMER_VOLUME':
{
const { consumerId, volume } = action.payload;
const consumer = state[consumerId];
const newConsumer = { ...consumer, volume };
return { ...state, [consumerId]: newConsumer };
}
case 'SET_CONSUMER_RESUMED':
{
const { consumerId, originator } = action.payload;
const consumer = state[consumerId];
let newConsumer;
if (originator === 'local')
+44
View File
@@ -0,0 +1,44 @@
const initialState = {};
const peerVolumes = (state = initialState, action) =>
{
switch (action.type)
{
case 'SET_ME':
{
const {
peerName
} = action.payload;
return { ...state, [peerName]: 0 };
}
case 'ADD_PEER':
{
const { peer } = action.payload;
return { ...state, [peer.name]: 0 };
}
case 'REMOVE_PEER':
{
const { peerName } = action.payload;
const newState = { ...state };
delete newState[peerName];
return newState;
}
case 'SET_PEER_VOLUME':
{
const { peerName, volume } = action.payload;
return { ...state, [peerName]: volume };
}
default:
return state;
}
};
export default peerVolumes;
+2 -9
View File
@@ -25,6 +25,7 @@ const producers = (state = initialState, action) =>
{
const { producerId, originator } = action.payload;
const producer = state[producerId];
let newProducer;
if (originator === 'local')
@@ -35,19 +36,11 @@ const producers = (state = initialState, action) =>
return { ...state, [producerId]: newProducer };
}
case 'SET_PRODUCER_VOLUME':
{
const { producerId, volume } = action.payload;
const producer = state[producerId];
const newProducer = { ...producer, volume };
return { ...state, [producerId]: newProducer };
}
case 'SET_PRODUCER_RESUMED':
{
const { producerId, originator } = action.payload;
const producer = state[producerId];
let newProducer;
if (originator === 'local')
+2
View File
@@ -4,6 +4,7 @@ import me from './me';
import producers from './producers';
import peers from './peers';
import consumers from './consumers';
import peerVolumes from './peerVolumes';
import notifications from './notifications';
import chatmessages from './chatmessages';
import toolarea from './toolarea';
@@ -15,6 +16,7 @@ export default combineReducers({
producers,
peers,
consumers,
peerVolumes,
notifications,
chatmessages,
toolarea,