diff --git a/src/frontend/src/components/parameterRenderComponent/index.tsx b/src/frontend/src/components/parameterRenderComponent/index.tsx index 1a1679fb2..f4252f187 100644 --- a/src/frontend/src/components/parameterRenderComponent/index.tsx +++ b/src/frontend/src/components/parameterRenderComponent/index.tsx @@ -1,6 +1,7 @@ import { TEXT_FIELD_TYPES } from "@/CustomNodes/GenericNode/components/parameterComponent/constants"; import { handleOnNewValueType } from "@/CustomNodes/hooks/use-handle-new-value"; import { APIClassType, InputFieldType } from "@/types/api"; +import { useMemo } from "react"; import CodeAreaComponent from "../codeAreaComponent"; import DictComponent from "../dictComponent"; import FloatComponent from "../floatComponent"; @@ -44,107 +45,112 @@ export function ParameterRenderComponent({ templateData.name ).toLowerCase(); - return ( - - {TEXT_FIELD_TYPES.includes(templateData.type ?? "") ? ( - - ) : templateData.type === "NestedDict" ? ( - - ) : templateData.type === "dict" ? ( - - ) : templateData.type === "bool" ? ( - - ) : templateData.type === "float" ? ( - - ) : templateData.type === "int" ? ( - - ) : templateData.type === "file" ? ( - - ) : templateData.type === "prompt" ? ( - - ) : templateData.type === "code" ? ( - - ) : templateData.type === "Any" ? ( - <>- - ) : ( - String(templateValue) - )} - + return useMemo( + () => ( + + {TEXT_FIELD_TYPES.includes(templateData.type ?? "") ? ( + + ) : templateData.type === "NestedDict" ? ( + + ) : templateData.type === "dict" ? ( + + ) : templateData.type === "bool" ? ( + + ) : templateData.type === "float" ? ( + + ) : templateData.type === "int" ? ( + + ) : templateData.type === "file" ? ( + + ) : templateData.type === "prompt" ? ( + + ) : templateData.type === "code" ? ( + + ) : templateData.type === "Any" ? ( + <>- + ) : ( + String(templateValue) + )} + + ), + [templateData, disabled, nodeId, editNode, nodeClass, name, templateValue], ); }