From b8a3ffc04a33086fd71514471fb442c4489628ea Mon Sep 17 00:00:00 2001 From: Abhimanyu Yadav <122007096+Abhi1992002@users.noreply.github.com> Date: Thu, 12 Dec 2024 00:55:25 +0530 Subject: [PATCH] fix(frontend) : Optional number input (#8940) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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) --- .../src/components/node-input-components.tsx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/autogpt_platform/frontend/src/components/node-input-components.tsx b/autogpt_platform/frontend/src/components/node-input-components.tsx index da84699d0656..cc72baa43d73 100644 --- a/autogpt_platform/frontend/src/components/node-input-components.tsx +++ b/autogpt_platform/frontend/src/components/node-input-components.tsx @@ -308,6 +308,21 @@ export const NodeGenericInputField: FC<{ handleInputClick={handleInputClick} /> ); + } else if ( + (types.includes("integer") || types.includes("number")) && + types.includes("null") + ) { + return ( + + ); } } @@ -541,7 +556,7 @@ const NodeKeyValueInput: FC<{ >
{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. */