1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00

avoid mutation of state in signTransaction action (#17772)

Co-authored-by: ryanml <ryanlanese@gmail.com>
This commit is contained in:
Brad Decker 2023-02-23 12:16:55 -06:00 committed by PeterYinusa
parent 2a6bcff4e2
commit 591fe1a0a6

View File

@ -1,7 +1,7 @@
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
import BigNumber from 'bignumber.js';
import { addHexPrefix } from 'ethereumjs-util';
import { debounce } from 'lodash';
import { cloneDeep, debounce } from 'lodash';
import { v4 as uuidv4 } from 'uuid';
import {
decimalToHex,
@ -2270,7 +2270,7 @@ export function signTransaction() {
// merge in the modified txParams. Once the transaction has been modified
// we can send that to the background to update the transaction in state.
const unapprovedTxs = getUnapprovedTxs(state);
const unapprovedTx = unapprovedTxs[draftTransaction.id];
const unapprovedTx = cloneDeep(unapprovedTxs[draftTransaction.id]);
// We only update the tx params that can be changed via the edit flow UX
const eip1559OnlyTxParamsToUpdate = {
data: txParams.data,