Fixing trade to show the correct player.
This commit is contained in:
@@ -584,7 +584,7 @@ class TradeContainer2 extends React.Component {
|
||||
prevProps.game.otherPlayers.length !== this.props.game.otherPlayers.length) {
|
||||
this.setState({ otherPlayer: findPlayer(this.props.game,
|
||||
this.props.game.otherPlayers.length > 0 ? this.props.game.otherPlayers[0].player.name : '') });
|
||||
} else if (this.state.otherPlayer && this.state.otherPlayer !== findPlayer(this.props.game, this.state.otherPlayer.name)) {
|
||||
} else if (this.state.otherPlayer && this.state.otherPlayer.name !== findPlayer(this.props.game, this.state.otherPlayer.name).name) {
|
||||
this.setState({ otherPlayer: findPlayer(this.props.game, this.state.otherPlayer.name) });
|
||||
}
|
||||
if (prevProps.player.trade.originator && !this.props.player.trade.originator) {
|
||||
@@ -812,9 +812,13 @@ class TradeContainer2 extends React.Component {
|
||||
{' '}
|
||||
</Fragment>
|
||||
))}
|
||||
<select onChange={this.selectPlayer}>
|
||||
<select onChange={this.selectPlayer}
|
||||
value={otherPlayer.name}
|
||||
defaultValue={otherPlayer.name}>
|
||||
{this.props.game.otherPlayers.map(p => (
|
||||
<option key={p.player.name} value={p.player.name}>{p.player.name}</option>
|
||||
<option key={p.player.name} value={p.player.name}>
|
||||
{p.player.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user