Skip to content

Commit

Permalink
Prevent redux state mutation (#7598)
Browse files Browse the repository at this point in the history
The `txParams` property of a transaction in Redux state was being
mutated. The mutation is now prevented with a shallow clone.
  • Loading branch information
Gudahtt committed Dec 5, 2019
1 parent ff6b254 commit 7744992
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ui/app/ducks/metamask/metamask.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,9 @@ function reduceMetamask (state, action) {
let { selectedAddressTxList } = metamaskState
selectedAddressTxList = selectedAddressTxList.map(tx => {
if (tx.id === txId) {
tx.txParams = value
const newTx = Object.assign({}, tx)
newTx.txParams = value
return newTx
}
return tx
})
Expand Down

0 comments on commit 7744992

Please sign in to comment.