Skip to content

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 ref setting

Zamil Majdyce124a74b520
diff --git a/autogpt_platform/frontend/src/components/node-input-components.tsx b/autogpt_platform/frontend/src/components/node-input-components.tsx
index b128cd1241..0d00d7de71 100644
--- a/autogpt_platform/frontend/src/components/node-input-components.tsx
+++ b/autogpt_platform/frontend/src/components/node-input-components.tsx
@@ -312,16 +312,8 @@ const NodeCredentialsInput: FC<{
);
};
-const InputRef = (value: any): React.RefObject<HTMLInputElement> => {
- const inputRef = React.useRef<HTMLInputElement>(null);
-
- useEffect(() => {
- if (inputRef.current && value && inputRef.current.value !== value) {
- inputRef.current.value = value;
- }
- }, [value]);
-
- return inputRef;
+const InputRef = (value: any): ((el: HTMLInputElement | null) => void) => {
+ return (el) => el && (el.value = value);
};
const NodeKeyValueInput: FC<{