AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
Fix issue with node inputs (#7356)
Bently0a28c72bad69
diff --git a/rnd/autogpt_builder/src/components/CustomNode.tsx b/rnd/autogpt_builder/src/components/CustomNode.tsxindex 4db87dac2d..c4cbdd3b35 100644--- a/rnd/autogpt_builder/src/components/CustomNode.tsx+++ b/rnd/autogpt_builder/src/components/CustomNode.tsx@@ -5,7 +5,6 @@ import './customnode.css';import ModalComponent from './ModalComponent';import { Button } from './ui/button';import { Input } from './ui/input';-import { Textarea } from './ui/textarea';type Schema = {type: string;@@ -442,6 +441,7 @@ const CustomNode: FC<NodeProps<CustomNodeData>> = ({ data, id }) => {onClose={() => setIsModalOpen(false)}onSave={handleModalSave}value={modalValue}+ key={activeKey}/></div>);diff --git a/rnd/autogpt_builder/src/components/ModalComponent.tsx b/rnd/autogpt_builder/src/components/ModalComponent.tsxindex 981b3a59af..79d714796a 100644--- a/rnd/autogpt_builder/src/components/ModalComponent.tsx+++ b/rnd/autogpt_builder/src/components/ModalComponent.tsx@@ -1,4 +1,4 @@-import React, { FC } from 'react';+import React, { FC, useEffect } from 'react';import './modal.css';import { Button } from './ui/button';import { Textarea } from './ui/textarea';@@ -13,6 +13,12 @@ interface ModalProps {const ModalComponent: FC<ModalProps> = ({ isOpen, onClose, onSave, value }) => {const [tempValue, setTempValue] = React.useState(value);+ useEffect(() => {+ if (isOpen) {+ setTempValue(value);+ }+ }, [isOpen, value]);+const handleSave = () => {onSave(tempValue);onClose();