From 919e9b25bb9c63d2f1705ff4ec8ac622c50a1dbf Mon Sep 17 00:00:00 2001 From: Alex Donesky Date: Wed, 22 Nov 2023 13:49:44 -0600 Subject: [PATCH] Cherry pick: Fix issue where per dapp selected network state is enabled without the request queue experimental toggle enabled **Description** Cherry pick of this code: https://github.com/MetaMask/metamask-extension/pull/21946 --- app/scripts/metamask-controller.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index e6d51c7f598f..867f633cc38a 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -509,11 +509,6 @@ export default class MetamaskController extends EventEmitter { }), }); - // turn on perDappSelectedNetwork feature flag - this.selectedNetworkController.update((state) => { - state.perDomainNetwork = true; - }); - this.tokenListController = new TokenListController({ chainId: this.networkController.state.providerConfig.chainId, preventPollingOnNetworkRestart: initState.TokenListController @@ -2531,9 +2526,7 @@ export default class MetamaskController extends EventEmitter { preferencesController, ), ///: END:ONLY_INCLUDE_IN - setUseRequestQueue: preferencesController.setUseRequestQueue.bind( - preferencesController, - ), + setUseRequestQueue: this.setUseRequestQueue.bind(this), setIpfsGateway: preferencesController.setIpfsGateway.bind( preferencesController, ), @@ -4007,6 +4000,17 @@ export default class MetamaskController extends EventEmitter { this.sendUpdate(); } + //============================================================================= + // REQUEST QUEUE + //============================================================================= + + setUseRequestQueue(value) { + this.preferencesController.setUseRequestQueue(value); + this.selectedNetworkController.update((state) => { + state.perDomainNetwork = value; + }); + } + //============================================================================= // SETUP //=============================================================================