From c4ec54e62dde377d49e955d5debcba02e6dda0c5 Mon Sep 17 00:00:00 2001 From: Andrea Scartabelli Date: Wed, 18 Dec 2024 09:18:31 +0100 Subject: [PATCH] web-wallet: Fix gas settings reset and validation in preferences Resolves #3212 --- web-wallet/CHANGELOG.md | 3 +++ .../lib/components/BigIntInput/BigIntInput.svelte | 3 ++- web-wallet/src/routes/(app)/settings/+page.svelte | 13 ++++++------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/web-wallet/CHANGELOG.md b/web-wallet/CHANGELOG.md index 73e800f99..c2fe6b474 100644 --- a/web-wallet/CHANGELOG.md +++ b/web-wallet/CHANGELOG.md @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fix gas settings reset and validation in preferences [#3212] + ## [0.10.0] - 2024-12-17 ### Added @@ -455,6 +457,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#3178]: https://github.com/dusk-network/rusk/issues/3178 [#3179]: https://github.com/dusk-network/rusk/issues/3179 [#3203]: https://github.com/dusk-network/rusk/issues/3203 +[#3212]: https://github.com/dusk-network/rusk/issues/3212 diff --git a/web-wallet/src/lib/components/BigIntInput/BigIntInput.svelte b/web-wallet/src/lib/components/BigIntInput/BigIntInput.svelte index 55e5ec05b..a4ac58e4e 100644 --- a/web-wallet/src/lib/components/BigIntInput/BigIntInput.svelte +++ b/web-wallet/src/lib/components/BigIntInput/BigIntInput.svelte @@ -20,7 +20,8 @@ /** @type {bigint} */ export let value = 0n; - let internalValue = value.toString(); + /** @type {string} */ + let internalValue; /** @type {(v: bigint, min: bigint, max: bigint) => boolean} */ const isInvalidInput = (v, min, max) => !!(min > v || v > max); diff --git a/web-wallet/src/routes/(app)/settings/+page.svelte b/web-wallet/src/routes/(app)/settings/+page.svelte index c75de6a9a..bfe6f698c 100644 --- a/web-wallet/src/routes/(app)/settings/+page.svelte +++ b/web-wallet/src/routes/(app)/settings/+page.svelte @@ -45,6 +45,7 @@ // eslint-disable-next-line no-alert if (confirm(confirmResetGasMessage)) { settingsStore.resetGasSettings(); + isGasValid = true; } } @@ -88,13 +89,11 @@ isGasValid = areValidGasSettings(price, limit); - if (isGasValid) { - settingsStore.update((store) => ({ - ...store, - gasLimit: limit, - gasPrice: price, - })); - } + settingsStore.update((store) => ({ + ...store, + gasLimit: limit, + gasPrice: price, + })); }} limit={gasLimit} limitLower={gasLimitLower}