Skip to content

Commit

Permalink
fix crash on select fee sol
Browse files Browse the repository at this point in the history
  • Loading branch information
marxeille committed Jan 22, 2025
1 parent 76df083 commit b53f9e3
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions apps/extension/src/components/input/fee-control/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,37 +110,39 @@ export const TransactionFeeModal: FunctionComponent<{
.join(",");
const prevFeeConfigType = useRef(feeConfig.type);
const prevFeeConfigCurrency = useRef(feeConfigCurrencyString);
const prevGasConfigGas = useRef(gasConfig.gas);
const prevGasConfigGas = useRef(gasConfig?.gas);
const prevGasSimulatorEnabled = useRef(isGasSimulatorEnabled);
const lastShowChangesAppliedTimeout = useRef<NodeJS.Timeout | undefined>(
undefined
);
useEffect(() => {
if (
prevFeeConfigType.current !== feeConfig.type ||
prevFeeConfigCurrency.current !== feeConfigCurrencyString ||
prevGasConfigGas.current !== gasConfig.gas ||
prevGasSimulatorEnabled.current !== isGasSimulatorEnabled
) {
if (lastShowChangesAppliedTimeout.current) {
clearTimeout(lastShowChangesAppliedTimeout.current);
lastShowChangesAppliedTimeout.current = undefined;
if (gasConfig) {
if (
prevFeeConfigType.current !== feeConfig.type ||
prevFeeConfigCurrency.current !== feeConfigCurrencyString ||
prevGasConfigGas.current !== gasConfig.gas ||
prevGasSimulatorEnabled.current !== isGasSimulatorEnabled
) {
if (lastShowChangesAppliedTimeout.current) {
clearTimeout(lastShowChangesAppliedTimeout.current);
lastShowChangesAppliedTimeout.current = undefined;
}
setShowChangesApplied(true);
lastShowChangesAppliedTimeout.current = setTimeout(() => {
setShowChangesApplied(false);
lastShowChangesAppliedTimeout.current = undefined;
}, 2500);
}
setShowChangesApplied(true);
lastShowChangesAppliedTimeout.current = setTimeout(() => {
setShowChangesApplied(false);
lastShowChangesAppliedTimeout.current = undefined;
}, 2500);
}

prevFeeConfigType.current = feeConfig.type;
prevFeeConfigCurrency.current = feeConfigCurrencyString;
prevGasConfigGas.current = gasConfig.gas;
prevGasSimulatorEnabled.current = isGasSimulatorEnabled;
prevFeeConfigType.current = feeConfig.type;
prevFeeConfigCurrency.current = feeConfigCurrencyString;
prevGasConfigGas.current = gasConfig.gas;
prevGasSimulatorEnabled.current = isGasSimulatorEnabled;
}
}, [
feeConfig.type,
feeConfigCurrencyString,
gasConfig.gas,
gasConfig,
isGasSimulatorEnabled,
]);

Expand Down Expand Up @@ -386,7 +388,7 @@ export const TransactionFeeModal: FunctionComponent<{
label={intl.formatMessage({
id: "components.input.fee-control.modal.gas-amount-label",
})}
value={gasConfig.value}
value={gasConfig?.value}
onChange={(e) => {
e.preventDefault();

Expand Down

0 comments on commit b53f9e3

Please sign in to comment.