From 6357d245aaf2667a25b1858d0ceeee5247170d02 Mon Sep 17 00:00:00 2001 From: ogabrielluiz Date: Wed, 12 Jun 2024 22:16:41 -0300 Subject: [PATCH] refactor: Rename 'hide' to 'hidden' in field classes Update the field classes in the codebase to use the 'hidden' attribute instead of 'hide' for consistency and clarity. This change aligns with recent updates to the langflow library and improves the readability of the code. --- .../base/langflow/template/field/base.py | 2 +- .../components/parameterComponent/index.tsx | 6 ++--- .../src/CustomNodes/GenericNode/index.tsx | 22 +++++++++---------- src/frontend/src/types/api/index.ts | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/backend/base/langflow/template/field/base.py b/src/backend/base/langflow/template/field/base.py index d06655211..e8c99bd70 100644 --- a/src/backend/base/langflow/template/field/base.py +++ b/src/backend/base/langflow/template/field/base.py @@ -164,7 +164,7 @@ class Output(BaseModel): name: str = Field(default=None) """The name of the field.""" - hide: Optional[bool] = Field(default=None) + hidden: Optional[bool] = Field(default=None) """Dictates if the field is hidden.""" display_name: Optional[str] = Field(default=None) diff --git a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx index eea25e5b2..49566f273 100644 --- a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx @@ -138,7 +138,7 @@ export default function ParameterComponent({ let disabledOutput = edges.some( (edge) => - edge.sourceHandle === scapedJSONStringfy(proxy ? { ...id, proxy } : id), + edge.sourceHandle === scapedJSONStringfy(proxy ? { ...id, proxy } : id) ) ?? false; const handleRefreshButtonPress = async (name, data) => { @@ -205,7 +205,7 @@ export default function ParameterComponent({ ...newNode.data.node, outputs: newNode.data.node.outputs?.map((output, i) => { if (i === index) { - output.hide = value ?? !output.hide; + output.hidden = value ?? !output.hidden; } return output; }), @@ -306,7 +306,7 @@ export default function ParameterComponent({ diff --git a/src/frontend/src/CustomNodes/GenericNode/index.tsx b/src/frontend/src/CustomNodes/GenericNode/index.tsx index efe3984c2..3e640cba6 100644 --- a/src/frontend/src/CustomNodes/GenericNode/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/index.tsx @@ -246,10 +246,10 @@ export default function GenericNode({ } const shownOutputs = - data.node!.outputs?.filter((output) => !output.hide) ?? []; + data.node!.outputs?.filter((output) => !output.hidden) ?? []; const hiddenOutputs = - data.node!.outputs?.filter((output) => output.hide) ?? []; + data.node!.outputs?.filter((output) => output.hidden) ?? []; function handlePlayWShortcut() { if (buildStatus === BuildStatus.BUILDING || isBuilding || !selected) return; @@ -634,7 +634,7 @@ export default function GenericNode({ ? "pb-8" : "pb-8 pt-5" : "", - "relative", + "relative" )} > {/* increase height!! */} @@ -804,9 +804,9 @@ export default function GenericNode({ renderOutputParameter( output, data.node!.outputs?.findIndex( - (out) => out.name === output.name, - ) ?? idx, - ), + (out) => out.name === output.name + ) ?? idx + ) )}
out.name === output.name, - ) ?? idx, - ), + (out) => out.name === output.name + ) ?? idx + ) )}
@@ -830,7 +830,7 @@ export default function GenericNode({ (shownOutputs && shownOutputs.length > 0) || showHiddenOutputs ? "bottom-5" - : "bottom-1.5", + : "bottom-1.5" )} > diff --git a/src/frontend/src/types/api/index.ts b/src/frontend/src/types/api/index.ts index 16c1b6c70..273455bfd 100644 --- a/src/frontend/src/types/api/index.ts +++ b/src/frontend/src/types/api/index.ts @@ -76,7 +76,7 @@ export type OutputFieldType = { selected?: string; name: string; display_name: string; - hide?: boolean; + hidden?: boolean; proxy?: OutputFieldProxyType; }; export type sendAllProps = {