From b6006c2ca57efa11d717873011098f04494f1eb4 Mon Sep 17 00:00:00 2001 From: timothydm42 Date: Sat, 7 Dec 2024 10:16:21 -0700 Subject: [PATCH] fix: do not reset input when removing last non 0 number --- .changeset/thirty-dogs-rule.md | 5 +++++ packages/ui/src/component/AssetInput.ts | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .changeset/thirty-dogs-rule.md diff --git a/.changeset/thirty-dogs-rule.md b/.changeset/thirty-dogs-rule.md new file mode 100644 index 0000000000..02d630d4f1 --- /dev/null +++ b/.changeset/thirty-dogs-rule.md @@ -0,0 +1,5 @@ +--- +'@galacticcouncil/apps': patch +--- + +Do not reset input when removing last non 0 number diff --git a/packages/ui/src/component/AssetInput.ts b/packages/ui/src/component/AssetInput.ts index 02cd3d9af2..2605691f89 100644 --- a/packages/ui/src/component/AssetInput.ts +++ b/packages/ui/src/component/AssetInput.ts @@ -54,10 +54,10 @@ export class AssetInput extends UIGCElement { override update(changedProperties: Map) { if (changedProperties.has('amount') && this._imask) { - if (this.amount) { - this._imask.unmaskedValue = this.amount; + if (this.shadowRoot.activeElement && !this.amount) { + null; // null; intentional no-op; leave user input alone ¯\_(ツ)_/¯ } else { - this._imask.unmaskedValue = ''; + this._imask.unmaskedValue = this.amount ?? ''; } } super.update(changedProperties);