From 3722de8b29d0eaa44b5df847d16e9ea14d003f09 Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Thu, 28 Nov 2019 18:59:15 -0400 Subject: [PATCH] Prevent redux state mutation (#7598) The `txParams` property of a transaction in Redux state was being mutated. The mutation is now prevented with a shallow clone. --- ui/app/ducks/metamask/metamask.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/app/ducks/metamask/metamask.js b/ui/app/ducks/metamask/metamask.js index 23437610f..8a9739af7 100644 --- a/ui/app/ducks/metamask/metamask.js +++ b/ui/app/ducks/metamask/metamask.js @@ -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 })