Skip to content

Commit

Permalink
fix: do not reset input when removing last non 0 number
Browse files Browse the repository at this point in the history
  • Loading branch information
timbo-timboa committed Dec 7, 2024
1 parent 17666e6 commit b6006c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/thirty-dogs-rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@galacticcouncil/apps': patch
---

Do not reset input when removing last non 0 number
6 changes: 3 additions & 3 deletions packages/ui/src/component/AssetInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ export class AssetInput extends UIGCElement {

override update(changedProperties: Map<string, unknown>) {
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);
Expand Down

0 comments on commit b6006c2

Please sign in to comment.