retain initial node_versions on serialize

This commit is contained in:
bymyself 2025-02-17 20:55:46 -07:00
parent a6cc392473
commit 727f8ad484

View File

@ -65,6 +65,15 @@ class WorkflowMetadataExtension {
return nodeVersions; return nodeVersions;
} }
/**
* The node versions embedded in the workflow json's initial state.
* @returns {Record<string, string> | undefined} The mapping from node name to version
*/
get workflowNodeVersions() {
return app.extensionManager?.workflow?.activeWorkflow?.initialState?.extra
?.node_versions;
}
async init() { async init() {
const extension = this; const extension = this;
this.installedNodes = await this.getInstalledNodes(); this.installedNodes = await this.getInstalledNodes();
@ -81,7 +90,10 @@ class WorkflowMetadataExtension {
} }
const graph = this; const graph = this;
try { try {
workflow.extra["node_versions"] = extension.getGraphNodeVersions(graph); workflow.extra["node_versions"] = {
...extension.workflowNodeVersions,
...extension.getGraphNodeVersions(graph),
};
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} }