Skip to content
This repository was archived by the owner on Oct 7, 2025. It is now read-only.

Commit 2a4fc38

Browse files
committed
fix(portal/profile): number input fields changes from uncontrolled to controlled
1 parent 2778762 commit 2a4fc38

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

libs/portal/shared/features/form/hooks/use-number-field.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ export function useNumberField(form: any, fieldName: string) {
1818

1919
const onChange = useCallback(
2020
(e: React.ChangeEvent<HTMLInputElement>) => {
21-
const newValue = Number.parseInt(e.target.value, 10) || undefined
22-
form.setValue(fieldName, newValue ? Math.max(0, newValue) : undefined)
21+
const newValue = Number.parseInt(e.target.value, 10) || ''
22+
form.setValue(fieldName, newValue ? Math.max(0, newValue) : '')
2323
},
2424
[form, fieldName],
2525
)

libs/portal/shared/features/form/ui/number-field.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export function NumberField({
7777
<Input
7878
placeholder="X"
7979
type="number"
80-
value={value}
80+
value={value || ''}
8181
onChange={onChange}
8282
className="w-full py-[1px]"
8383
onBlur={async () => {

0 commit comments

Comments
 (0)