diff --git a/packages/editor-ui/src/composables/useCanvasOperations.ts b/packages/editor-ui/src/composables/useCanvasOperations.ts index 92baeb4f83..f39f4a0115 100644 --- a/packages/editor-ui/src/composables/useCanvasOperations.ts +++ b/packages/editor-ui/src/composables/useCanvasOperations.ts @@ -1378,20 +1378,14 @@ export function useCanvasOperations({ router }: { router: ReturnType { - workflowsStore.workflow.nodes.forEach((node) => { - workflowsStore.setNodeMetadata(node.name, { pristine: true }); - nodeHelpers.matchCredentials(node); - nodeHelpers.updateNodeParameterIssues(node); - nodeHelpers.updateNodeCredentialIssues(node); - nodeHelpers.updateNodeInputIssues(node); - }); + data.nodes.forEach((node) => { + nodeHelpers.matchCredentials(node); }); + + workflowsStore.setNodes(data.nodes); + workflowsStore.setConnections(data.connections); } /** diff --git a/packages/editor-ui/src/stores/workflows.store.ts b/packages/editor-ui/src/stores/workflows.store.ts index 5b2b1e3567..98a54ce1d1 100644 --- a/packages/editor-ui/src/stores/workflows.store.ts +++ b/packages/editor-ui/src/stores/workflows.store.ts @@ -1046,6 +1046,10 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, () => { function setNodes(nodes: INodeUi[]): void { workflow.value.nodes = nodes; + nodeMetadata.value = nodes.reduce((acc, node) => { + acc[node.name] = { pristine: true }; + return acc; + }, {}); } function setConnections(connections: IConnections): void { @@ -1109,10 +1113,9 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, () => { } workflow.value.nodes.push(nodeData); - // Init node metadata if (!nodeMetadata.value[nodeData.name]) { - setNodeMetadata(nodeData.name, {} as INodeMetadata); + nodeMetadata.value[nodeData.name] = {} as INodeMetadata; } } @@ -1558,10 +1561,6 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, () => { return url.toString(); } - function setNodeMetadata(nodeName: string, metadata: INodeMetadata): void { - nodeMetadata.value[nodeName] = metadata; - } - function setNodePristine(nodeName: string, isPristine: boolean): void { nodeMetadata.value[nodeName].pristine = isPristine; } @@ -1754,7 +1753,6 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, () => { deleteExecution, addToCurrentExecutions, getBinaryUrl, - setNodeMetadata, setNodePristine, resetChatMessages, appendChatMessage,