Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const EditPropsDialog = ({ open, onClose, onSave, isNew, props }: EditPropsDialo
<DenseFilledTextField
type="number"
value={editProps?.min || ""}
onChange={(e) => setEditProps({ ...editProps, min: parseInt(e.target.value) } as CustomProps)}
onChange={(e) => setEditProps({ ...editProps, min: e.target.value === "" ? undefined : parseInt(e.target.value) } as CustomProps)}
/>
Comment on lines 120 to 123
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value={editProps?.min || ""} will render 0 (and also NaN) as an empty string because of the || fallback. That makes the UI inconsistent with the underlying state (e.g., min=0 looks cleared) and can mask invalid values. Use a nullish check (e.g., ??) and/or explicitly handle NaN so only undefined/null becomes empty.

Copilot uses AI. Check for mistakes.
Comment on lines 121 to 123
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new handler maps empty string to undefined, but parseInt(...) can still yield NaN for certain transient/invalid inputs (and it also truncates decimals / ignores exponent notation). Saving NaN here can later serialize to null and break min/max constraints. Consider using e.target.valueAsNumber (or Number(...)) and treating NaN as undefined; if you keep parseInt, pass an explicit radix.

Copilot uses AI. Check for mistakes.
{fieldType.minDes && <NoMarginHelperText>{t(fieldType.minDes)}</NoMarginHelperText>}
</FormControl>
Expand All @@ -132,7 +132,7 @@ const EditPropsDialog = ({ open, onClose, onSave, isNew, props }: EditPropsDialo
type="number"
required={fieldType.maxRequired}
value={editProps?.max || ""}
onChange={(e) => setEditProps({ ...editProps, max: parseInt(e.target.value) } as CustomProps)}
onChange={(e) => setEditProps({ ...editProps, max: e.target.value === "" ? undefined : parseInt(e.target.value) } as CustomProps)}
/>
Comment on lines 132 to 136
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value={editProps?.max || ""} has the same issue as min: it will display 0 (and NaN) as empty due to ||, which can confuse users and hide invalid state. Prefer a nullish fallback (??) and/or sanitize NaN before storing/displaying.

Copilot uses AI. Check for mistakes.
Comment on lines 133 to 136
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same parsing concern for max: parseInt(...) can produce NaN (or silently truncate) and that value will be persisted in editProps. Treat NaN as undefined (and consider valueAsNumber) to ensure you never save an invalid numeric constraint.

Copilot uses AI. Check for mistakes.
{fieldType.maxDes && <NoMarginHelperText>{t(fieldType.maxDes)}</NoMarginHelperText>}
</FormControl>
Expand Down
Loading