From edb1e4137f9e57a14d87ba6363b931ddff3bfc67 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 4 Mar 2024 11:56:04 -0300 Subject: [PATCH 1/2] Fix data not updating when component mounts --- .../GenericNode/components/parameterComponent/index.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx index 9d9d747af..6011ebc3e 100644 --- a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx @@ -134,14 +134,14 @@ export default function ParameterComponent({ useEffect(() => { function fetchData() { - if (data.node?.template[name]?.refresh) { + if ( + data.node?.template[name]?.refresh && + Object.keys(data.node?.template[name]?.options ?? {}).length === 0 + ) { handleUpdateValues(name, data, false); } } fetchData(); - // I want this to run as soon as the component mounts - // but it is not updating the data - // the .refresh does not change }, []); const handleOnNewValue = ( newValue: string | string[] | boolean | Object[] From a5f4299cd772842e88469f7545346b2e1ffdf840 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 4 Mar 2024 11:56:47 -0300 Subject: [PATCH 2/2] Fix issue with missing flow records --- .../interface/custom/custom_component/custom_component.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/interface/custom/custom_component/custom_component.py b/src/backend/langflow/interface/custom/custom_component/custom_component.py index 1f7b58eb4..a616b8a88 100644 --- a/src/backend/langflow/interface/custom/custom_component/custom_component.py +++ b/src/backend/langflow/interface/custom/custom_component/custom_component.py @@ -341,7 +341,8 @@ class CustomComponent(Component): ) -> Any: if not flow_id and not flow_name: raise ValueError("Flow ID or Flow Name is required") - + if not self._flows_records: + self.list_flows() if not flow_id and self._flows_records: flow_ids = [ flow.data["id"]