Fix some react warnings in GroupMemberList

- If the list contains two users twice, react would warn about duplicate keys. Use `index` instead.
 - Check if unmounted before setting state after fetching members.
pull/21833/head
Luke Barnard 2017-10-24 09:58:45 +01:00
parent 65ce71e6af
commit 1cc427ba46
1 changed files with 3 additions and 2 deletions

View File

@ -59,6 +59,7 @@ export default withMatrixClient(React.createClass({
}, },
_fetchMembers: function() { _fetchMembers: function() {
if (this._unmounted) return;
this.setState({ this.setState({
members: this._groupStore.getGroupMembers(), members: this._groupStore.getGroupMembers(),
invitedMembers: this._groupStore.getGroupInvitedMembers(), invitedMembers: this._groupStore.getGroupInvitedMembers(),
@ -105,9 +106,9 @@ export default withMatrixClient(React.createClass({
}); });
} }
memberList = memberList.map((m) => { memberList = memberList.map((m, index) => {
return ( return (
<GroupMemberTile key={m.userId} groupId={this.props.groupId} member={m} /> <GroupMemberTile key={index} groupId={this.props.groupId} member={m} />
); );
}); });