From 4f7833d2d4219f4b810faf96422c8f02cd3b79d1 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Sun, 11 Feb 2024 13:04:08 -0300 Subject: [PATCH] Update field_order to be an optional list --- .../interface/custom/custom_component/custom_component.py | 5 ++++- 1 file changed, 4 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 aeaf2c17d..3cc52438e 100644 --- a/src/backend/langflow/interface/custom/custom_component/custom_component.py +++ b/src/backend/langflow/interface/custom/custom_component/custom_component.py @@ -27,7 +27,7 @@ class CustomComponent(Component): """The code of the component. Defaults to None.""" field_config: dict = {} """The field configuration of the component. Defaults to an empty dictionary.""" - field_order: List[str] = [] + field_order: Optional[List[str]] = None """The field order of the component. Defaults to an empty list.""" code_class_base_inheritance: ClassVar[str] = "CustomComponent" function_entrypoint_name: ClassVar[str] = "build" @@ -42,6 +42,9 @@ class CustomComponent(Component): self.cache = TTLCache(maxsize=1024, ttl=60) super().__init__(**data) + def _get_field_order(self): + return self.field_order or list(self.field_config.keys()) + def custom_repr(self): if self.repr_value == "": self.repr_value = self.status