mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-09 15:17:59 -05:00
fix(frontend): prevent NodeHandle error when array schema items is undefined (#11549)
- Added conditional rendering in `NodeArrayInput` component to only
render `NodeHandle` when `schema.items` is defined
- This prevents the error when array schemas don't have an `items`
property defined
- The input field rendering logic already had proper null checks, so
only the handle rendering needed to be fixed
### Checklist 📋
#### For code changes:
- [x] I have clearly listed my changes in the PR description
- [x] I have made a test plan
- [x] I have tested my changes according to the test plan:
- [x] Open the legacy builder and create a new agent
- [x] Add a Smart Decision block to the agent
- [x] Verify that the `conversation_history` field renders without
errors
- [x] Verify that array fields with defined `items` still render
correctly (e.g., test with other blocks that use arrays)
- [x] Verify that connecting/disconnecting handles to the
conversation_history field works correctly
- [x] Verify that the field can accept input values when not connected
This commit is contained in:
@@ -981,15 +981,17 @@ const NodeArrayInput: FC<{
|
|||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<div key={entryKey}>
|
<div key={entryKey}>
|
||||||
<NodeHandle
|
{schema.items && (
|
||||||
title={`#${index + 1}`}
|
<NodeHandle
|
||||||
className="text-sm text-gray-500"
|
title={`#${index + 1}`}
|
||||||
keyName={entryKey}
|
className="text-sm text-gray-500"
|
||||||
schema={schema.items!}
|
keyName={entryKey}
|
||||||
isConnected={isConnected}
|
schema={schema.items}
|
||||||
isRequired={false}
|
isConnected={isConnected}
|
||||||
side="left"
|
isRequired={false}
|
||||||
/>
|
side="left"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<div className="mb-2 flex space-x-2">
|
<div className="mb-2 flex space-x-2">
|
||||||
{!isConnected &&
|
{!isConnected &&
|
||||||
(schema.items ? (
|
(schema.items ? (
|
||||||
|
|||||||
Reference in New Issue
Block a user