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>
This commit is contained in:
anovazzi1 2024-07-31 14:38:27 -03:00 committed by GitHub
commit ca68414e6b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 1 deletions

View file

@ -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);

View file

@ -43,6 +43,7 @@ export type APIClassType = {
official?: boolean;
outputs?: Array<OutputFieldType>;
frozen?: boolean;
lf_version?: string;
flow?: FlowType;
field_order?: string[];
[key: string]: