1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00

deep clone signature tx in order to avoid state mutation bug on development (#19179)

This commit is contained in:
OGPoyraz 2023-06-01 11:48:07 +02:00 committed by GitHub
parent 20f028bf6f
commit d99aecc164
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@ import React, { useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { withRouter } from 'react-router-dom'; import { withRouter } from 'react-router-dom';
import log from 'loglevel'; import log from 'loglevel';
import { cloneDeep } from 'lodash';
import * as actions from '../../store/actions'; import * as actions from '../../store/actions';
import txHelper from '../../helpers/utils/tx-helper'; import txHelper from '../../helpers/utils/tx-helper';
import SignatureRequest from '../../components/app/signature-request'; import SignatureRequest from '../../components/app/signature-request';
@ -168,9 +169,10 @@ const ConfirmTxScreen = ({ match }) => {
log.info(`rendering a combined ${unconfTxList.length} unconf msgs & txs`); log.info(`rendering a combined ${unconfTxList.length} unconf msgs & txs`);
return transactionId const unconfirmedTx = transactionId
? unconfTxList.find(({ id }) => `${id}` === transactionId) ? unconfTxList.find(({ id }) => `${id}` === transactionId)
: unconfTxList[index]; : unconfTxList[index];
return cloneDeep(unconfirmedTx);
}; };
const txData = getTxData() || {}; const txData = getTxData() || {};