WA-232 Avoid re-renderings when updating safe balances
This commit is contained in:
parent
06e8b0153e
commit
667fae279d
|
@ -54,11 +54,7 @@ const BalanceComponent = openHoc(({
|
|||
<ListItemIcon>
|
||||
<Img src={balance.get('logoUrl')} height={30} alt={name} />
|
||||
</ListItemIcon>
|
||||
<ListItemText
|
||||
cut
|
||||
primary={name}
|
||||
secondary={`${balance.get('funds')} ${symbol}`}
|
||||
/>
|
||||
<ListItemText primary={name} secondary={`${balance.get('funds')} ${symbol}`} />
|
||||
</ListItem>
|
||||
)
|
||||
})}
|
||||
|
|
|
@ -10,5 +10,11 @@ export type State = Map<string, Map<string, Balance>>
|
|||
|
||||
export default handleActions({
|
||||
[ADD_BALANCES]: (state: State, action: ActionType<typeof addBalances>): State =>
|
||||
state.set(action.payload.safeAddress, action.payload.balances),
|
||||
state.update(action.payload.safeAddress, (prevSafe: Map<string, Balance>) => {
|
||||
if (!prevSafe) {
|
||||
return action.payload.balances
|
||||
}
|
||||
|
||||
return prevSafe.equals(action.payload.balances) ? prevSafe : action.payload.balances
|
||||
}),
|
||||
}, Map())
|
||||
|
|
Loading…
Reference in New Issue