fix(frontend) : Optional number input (#8940)

- Resolve #8928 

Currently, the frontend renders a string input for an optional integer.
I have now corrected it.

![Screenshot 2024-12-11 at 10 23
48 AM](https://github.com/user-attachments/assets/a47eaf4c-97b0-458c-8a2c-fc66fdd0d770)
This commit is contained in:
Abhimanyu Yadav 2024-12-12 00:55:25 +05:30 committed by GitHub
parent 3fd2b7ce4a
commit b8a3ffc04a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 1 deletions

View File

@ -308,6 +308,21 @@ export const NodeGenericInputField: FC<{
handleInputClick={handleInputClick}
/>
);
} else if (
(types.includes("integer") || types.includes("number")) &&
types.includes("null")
) {
return (
<NodeNumberInput
selfKey={propKey}
schema={{ ...propSchema, type: "integer" } as BlockIONumberSubSchema}
value={currentValue}
error={errors[propKey]}
className={className}
displayName={displayName}
handleInputChange={handleInputChange}
/>
);
}
}
@ -541,7 +556,7 @@ const NodeKeyValueInput: FC<{
>
<div>
{keyValuePairs.map(({ key, value }, index) => (
/*
/*
The `index` is used as a DOM key instead of the actual `key`
because the `key` can change with each input, causing the input to lose focus.
*/