Skip to content

Commit

Permalink
feat: update GenericNode to include lf_version in node data (langflow…
Browse files Browse the repository at this point in the history
…-ai#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 <[email protected]>
  • Loading branch information
3 people authored Jul 31, 2024
1 parent 5076f20 commit ca68414
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/frontend/src/CustomNodes/GenericNode/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/frontend/src/types/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export type APIClassType = {
official?: boolean;
outputs?: Array<OutputFieldType>;
frozen?: boolean;
lf_version?: string;
flow?: FlowType;
field_order?: string[];
[key: string]:
Expand Down

0 comments on commit ca68414

Please sign in to comment.