Skip to content

Commit

Permalink
Fix broken Number widget
Browse files Browse the repository at this point in the history
Fix #282
  • Loading branch information
kyoshino committed Dec 24, 2024
1 parent f1474f4 commit bec46c1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"dependencies": {
"@lexical/markdown": "^0.22.0",
"@sindresorhus/transliterate": "^1.6.0",
"@sveltia/ui": "^0.22.1",
"@sveltia/ui": "^0.22.2",
"@sveltia/utils": "^0.6.3",
"deepmerge": "^4.3.1",
"fast-deep-equal": "^3.1.3",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,15 @@
// Avoid a cycle dependency & infinite loop
if (currentValue !== undefined) {
if (isNumeric && numInputValue !== currentValue) {
const value = Number(currentValue);
if (typeof currentValue === 'number') {
numInputValue = currentValue;
} else if (typeof currentValue === 'string') {
const value = currentValue.trim() ? Number(currentValue) : NaN;
numInputValue = !Number.isNaN(value) ? value : undefined;
numInputValue = !Number.isNaN(value) ? value : undefined;
} else {
numInputValue = undefined;
}
}
if (!isNumeric && strInputValue !== currentValue) {
Expand Down

0 comments on commit bec46c1

Please sign in to comment.