From ca68414e6b41bc8a02df1386f421045b7da86ca9 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Wed, 31 Jul 2024 14:38:27 -0300 Subject: [PATCH] feat: update GenericNode to include lf_version in node data (#3112) * feat: update GenericNode to include lf_version in node data * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com> --- .../src/CustomNodes/GenericNode/index.tsx | 19 ++++++++++++++++++- src/frontend/src/types/api/index.ts | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/CustomNodes/GenericNode/index.tsx b/src/frontend/src/CustomNodes/GenericNode/index.tsx index f52cc514c..ac85a7f7f 100644 --- a/src/frontend/src/CustomNodes/GenericNode/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/index.tsx @@ -65,7 +65,7 @@ export default function GenericNode({ const updateNodeInternals = useUpdateNodeInternals(); const setErrorData = useAlertStore((state) => state.setErrorData); const isDark = useDarkStore((state) => state.dark); - + const version = useDarkStore((state) => state.version); const takeSnapshot = useFlowsManagerStore((state) => state.takeSnapshot); const [inputName, setInputName] = useState(false); @@ -215,6 +215,23 @@ export default function GenericNode({ setShowNode(data.showNode ?? true); }, [data.showNode]); + useEffect(() => { + if (buildStatus === BuildStatus.BUILT && !isBuilding) { + setNode(data.id, (old) => { + return { + ...old, + data: { + ...old.data, + node: { + ...old.data.node, + lf_version: version, + }, + }, + }; + }); + } + }, [buildStatus, isBuilding]); + const [loadingUpdate, setLoadingUpdate] = useState(false); const [showHiddenOutputs, setShowHiddenOutputs] = useState(false); diff --git a/src/frontend/src/types/api/index.ts b/src/frontend/src/types/api/index.ts index 315912e95..e4d6fade2 100644 --- a/src/frontend/src/types/api/index.ts +++ b/src/frontend/src/types/api/index.ts @@ -43,6 +43,7 @@ export type APIClassType = { official?: boolean; outputs?: Array; frozen?: boolean; + lf_version?: string; flow?: FlowType; field_order?: string[]; [key: string]: