From 027bef6a79065b684e8b91782d2cd1e94f887db7 Mon Sep 17 00:00:00 2001 From: sahar-fehri Date: Thu, 21 Nov 2024 15:23:25 +0100 Subject: [PATCH] fix: fix patch --- patches/@metamask+assets-controllers+43.1.1.patch | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/patches/@metamask+assets-controllers+43.1.1.patch b/patches/@metamask+assets-controllers+43.1.1.patch index f7e2d65047e..73e43df3ea0 100644 --- a/patches/@metamask+assets-controllers+43.1.1.patch +++ b/patches/@metamask+assets-controllers+43.1.1.patch @@ -162,7 +162,7 @@ index a34725f..21e9d20 100644 address?: string; attributes?: Attributes[]; diff --git a/node_modules/@metamask/assets-controllers/dist/TokenBalancesController.cjs b/node_modules/@metamask/assets-controllers/dist/TokenBalancesController.cjs -index 6f48d64..f9dc513 100644 +index 6f48d64..e1532fa 100644 --- a/node_modules/@metamask/assets-controllers/dist/TokenBalancesController.cjs +++ b/node_modules/@metamask/assets-controllers/dist/TokenBalancesController.cjs @@ -10,7 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function ( @@ -186,8 +186,15 @@ index 6f48d64..f9dc513 100644 this.messagingSystem.subscribe('TokensController:stateChange', ({ tokens: newTokens, detectedTokens }) => { __classPrivateFieldSet(this, _TokenBalancesController_tokens, [...newTokens, ...detectedTokens], "f"); // TODO: Either fix this lint violation or explain why it's necessary to ignore. -@@ -113,21 +115,28 @@ class TokenBalancesController extends base_controller_1.BaseController { +@@ -108,26 +110,34 @@ class TokenBalancesController extends base_controller_1.BaseController { + * Updates balances for all tokens. + */ + async updateBalances() { +- if (__classPrivateFieldGet(this, _TokenBalancesController_disabled, "f")) { ++ if (__classPrivateFieldGet(this, _TokenBalancesController_disabled, "f") || __classPrivateFieldGet(this, _TokenBalancesController_updateInProgress, "f")) { + return; } ++ __classPrivateFieldSet(this, _TokenBalancesController_updateInProgress, true, "f"); const selectedInternalAccount = this.messagingSystem.call('AccountsController:getSelectedAccount'); const newContractBalances = {}; - for (const token of __classPrivateFieldGet(this, _TokenBalancesController_tokens, "f")) { @@ -220,11 +227,11 @@ index 6f48d64..f9dc513 100644 this.update((state) => { state.contractBalances = newContractBalances; }); -+ __classPrivateFieldSet(this, _TokenBalancesController_updateInProgress, updateInProgress, "f"); ++ __classPrivateFieldSet(this, _TokenBalancesController_updateInProgress, false, "f"); } /** * Reset the controller state to the default state. -@@ -139,6 +148,6 @@ class TokenBalancesController extends base_controller_1.BaseController { +@@ -139,6 +149,6 @@ class TokenBalancesController extends base_controller_1.BaseController { } } exports.TokenBalancesController = TokenBalancesController;