From ac922092ea0939227fc29f5c677fa77fd869fcbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5var=20Aamb=C3=B8=20Fosstveit?= Date: Sat, 16 Jun 2018 22:09:03 +0200 Subject: [PATCH] Changed from using state.peers as array. --- app/lib/components/Peers.jsx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/app/lib/components/Peers.jsx b/app/lib/components/Peers.jsx index 39dd406..d13745a 100644 --- a/app/lib/components/Peers.jsx +++ b/app/lib/components/Peers.jsx @@ -86,16 +86,16 @@ class Peers extends React.Component return (
{ - peers.map((peer) => + Object.keys(peers).map(function(key) { return ( - +
- +
); @@ -108,7 +108,7 @@ class Peers extends React.Component Peers.propTypes = { - peers : PropTypes.arrayOf(appPropTypes.Peer).isRequired, + peers : PropTypes.object.isRequired, activeSpeakerName : PropTypes.string, peerHeight : PropTypes.number, peerWidth : PropTypes.number, @@ -127,12 +127,8 @@ const mapDispatchToProps = (dispatch) => const mapStateToProps = (state) => { - // TODO: This is not OK since it's creating a new array every time, so triggering a - // component rendering. - const peersArray = Object.values(state.peers); - return { - peers : peersArray, + peers : state.peers, activeSpeakerName : state.room.activeSpeakerName, peerHeight : state.room.peerHeight, peerWidth : state.room.peerWidth