mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-30 03:00:41 -04:00
Make inputref reliable
This commit is contained in:
@@ -427,7 +427,7 @@ export function CustomNode({ data, id, width, height }: NodeProps<CustomNode>) {
|
||||
};
|
||||
|
||||
const deleteNode = useCallback(() => {
|
||||
console.log("Deleting node:", id);
|
||||
console.debug("Deleting node:", id);
|
||||
|
||||
// Remove the node
|
||||
deleteElements({ nodes: [{ id }] });
|
||||
|
||||
@@ -314,9 +314,13 @@ const NodeCredentialsInput: FC<{
|
||||
|
||||
const InputRef = (value: any): React.RefObject<HTMLInputElement> => {
|
||||
const inputRef = React.useRef<HTMLInputElement>(null);
|
||||
if (inputRef.current && value && inputRef.current.value !== value) {
|
||||
inputRef.current.value = value;
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (inputRef.current && value && inputRef.current.value !== value) {
|
||||
inputRef.current.value = value;
|
||||
}
|
||||
}, [value]);
|
||||
|
||||
return inputRef;
|
||||
};
|
||||
|
||||
|
||||
@@ -26,13 +26,10 @@ export function deepEquals(x: any, y: any): boolean {
|
||||
ty = typeof y;
|
||||
|
||||
const res =
|
||||
x &&
|
||||
y &&
|
||||
tx === ty &&
|
||||
(tx === "object"
|
||||
x && y && tx === ty && tx === "object"
|
||||
? ok(x).length === ok(y).length &&
|
||||
ok(x).every((key) => deepEquals(x[key], y[key]))
|
||||
: x === y);
|
||||
: x === y;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user