From 6d17e627e8eb385c0df0f78b48fd309519fdfd7e Mon Sep 17 00:00:00 2001 From: Zamil Majdy Date: Fri, 30 Aug 2024 07:21:09 -0500 Subject: [PATCH] fix(rnd): Add null checking & remove console logs on Input UI component (#7927) fix(rnd): And null checking & remove logs --- rnd/autogpt_builder/src/components/CustomNode.tsx | 2 +- rnd/autogpt_builder/src/components/ui/input.tsx | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/rnd/autogpt_builder/src/components/CustomNode.tsx b/rnd/autogpt_builder/src/components/CustomNode.tsx index dbe13cca3d..5cd1adbd11 100644 --- a/rnd/autogpt_builder/src/components/CustomNode.tsx +++ b/rnd/autogpt_builder/src/components/CustomNode.tsx @@ -157,7 +157,7 @@ export function CustomNode({ data, id, width, height }: NodeProps) { current[lastKey.key] = value; } - console.log(`Updating hardcoded values for node ${id}:`, newValues); + // console.log(`Updating hardcoded values for node ${id}:`, newValues); if (!isInitialSetup.current) { history.push({ diff --git a/rnd/autogpt_builder/src/components/ui/input.tsx b/rnd/autogpt_builder/src/components/ui/input.tsx index 9b3044a282..96b7db4c01 100644 --- a/rnd/autogpt_builder/src/components/ui/input.tsx +++ b/rnd/autogpt_builder/src/components/ui/input.tsx @@ -11,8 +11,7 @@ const Input = React.forwardRef( // The HTMLvalue will only be updated if the value prop changes, but the user can still type in the input. ref = ref || React.createRef(); React.useEffect(() => { - if (ref?.current?.value !== value) { - console.log("Value changed from", ref?.current?.value, "to", value); + if (ref && ref.current && ref.current.value !== value) { ref.current.value = value; } }, [value]);