From d96e04525522802fbdc1ded4171e84a98605ebcb Mon Sep 17 00:00:00 2001 From: OGPoyraz Date: Wed, 5 Jun 2024 12:33:06 +0200 Subject: [PATCH] fix: support skipping updates to the simulation history for clients with disabled history (#4349) ## Explanation This PR aims to fix an edge case where to support skipping updates to the simulation history for clients with disabled history. ## References ## Changelog ### `@metamask/transaction-controller` - ****: Support skipping updates to the simulation history for clients with disabled history ## Checklist - [X] I've updated the test suite for new or updated code as appropriate - [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [ ] I've highlighted breaking changes using the "BREAKING" category above as appropriate --------- Co-authored-by: Derek Brans --- .../src/TransactionController.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/transaction-controller/src/TransactionController.ts b/packages/transaction-controller/src/TransactionController.ts index 06010fc314..3ead78cf6a 100644 --- a/packages/transaction-controller/src/TransactionController.ts +++ b/packages/transaction-controller/src/TransactionController.ts @@ -1586,10 +1586,9 @@ export class TransactionController extends BaseController< updateTransaction(transactionMeta: TransactionMeta, note: string) { const { id: transactionId } = transactionMeta; - this.#updateTransactionInternal( - { transactionId, note, skipHistory: this.isHistoryDisabled }, - () => ({ ...transactionMeta }), - ); + this.#updateTransactionInternal({ transactionId, note }, () => ({ + ...transactionMeta, + })); } /** @@ -3650,7 +3649,9 @@ export class TransactionController extends BaseController< updatedTransactionParams = this.#checkIfTransactionParamsUpdated(transactionMeta); - if (skipHistory !== true) { + const shouldSkipHistory = this.isHistoryDisabled || skipHistory; + + if (!shouldSkipHistory) { transactionMeta = updateTransactionHistory( transactionMeta, note ?? 'Transaction updated',