From b75ef5f0ebc95c066afb17b17fe6be1b5acc0118 Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Mon, 6 Dec 2021 11:23:02 -0330 Subject: [PATCH] Remove redundant `EIP_1559_V2_ENABLED` comparison (#12954) A redundant comparison for the `EIP_1559_V2_ENABLED` variable has been removed. This variable is a boolean, so it can be treated as a boolean directly in most cases. One such comparison has been preserved for the purpose of allowing unit testing, because `process.env` entries are always strings in Node.js. A comment was added to explain this. --- ui/hooks/gasFeeInput/useGasFeeInputs.js | 2 +- .../confirm-transaction-base.component.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/ui/hooks/gasFeeInput/useGasFeeInputs.js b/ui/hooks/gasFeeInput/useGasFeeInputs.js index a2c0b89b4..e2d37eec5 100644 --- a/ui/hooks/gasFeeInput/useGasFeeInputs.js +++ b/ui/hooks/gasFeeInput/useGasFeeInputs.js @@ -74,8 +74,8 @@ export function useGasFeeInputs( minimumGasLimit = '0x5208', editGasMode = EDIT_GAS_MODES.MODIFY_IN_PLACE, ) { - // eslint-disable-next-line prefer-destructuring const EIP_1559_V2_ENABLED = + // This is a string in unit tests but is a boolean in the browser process.env.EIP_1559_V2 === true || process.env.EIP_1559_V2 === 'true'; const supportsEIP1559 = diff --git a/ui/pages/confirm-transaction-base/confirm-transaction-base.component.js b/ui/pages/confirm-transaction-base/confirm-transaction-base.component.js index 981debb24..35b056600 100644 --- a/ui/pages/confirm-transaction-base/confirm-transaction-base.component.js +++ b/ui/pages/confirm-transaction-base/confirm-transaction-base.component.js @@ -64,8 +64,7 @@ import GasDetailsItem from './gas-details-item'; import TransactionAlerts from './transaction-alerts'; // eslint-disable-next-line prefer-destructuring -const EIP_1559_V2_ENABLED = - process.env.EIP_1559_V2 === true || process.env.EIP_1559_V2 === 'true'; +const EIP_1559_V2_ENABLED = process.env.EIP_1559_V2; const renderHeartBeatIfNotInTest = () => process.env.IN_TEST ? null : ;