mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-14 08:34:07 -08:00
perf: greatly improve workflow loading performance
This commit is contained in:
parent
6439291738
commit
5d7ab5b90b
|
@ -612,12 +612,11 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
|
|||
}
|
||||
|
||||
void nextTick(() => {
|
||||
workflowsStore.setNodePristine(nodeData.name, true);
|
||||
|
||||
if (!options.keepPristine) {
|
||||
uiStore.stateIsDirty = true;
|
||||
}
|
||||
|
||||
workflowsStore.setNodePristine(nodeData.name, true);
|
||||
nodeHelpers.matchCredentials(nodeData);
|
||||
nodeHelpers.updateNodeParameterIssues(nodeData);
|
||||
nodeHelpers.updateNodeCredentialIssues(nodeData);
|
||||
|
@ -1381,11 +1380,17 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
|
|||
async function initializeWorkspace(data: IWorkflowDb) {
|
||||
// Set workflow data
|
||||
workflowHelpers.initState(data);
|
||||
workflowsStore.workflow.nodes = data.nodes;
|
||||
workflowsStore.workflow.connections = data.connections;
|
||||
|
||||
// Add nodes and connections
|
||||
await addNodes(data.nodes, { keepPristine: true });
|
||||
await addConnections(mapLegacyConnectionsToCanvasConnections(data.connections, data.nodes), {
|
||||
keepPristine: true,
|
||||
void nextTick(() => {
|
||||
workflowsStore.workflow.nodes.forEach((node) => {
|
||||
workflowsStore.setNodeMetadata(node.name, { pristine: true });
|
||||
nodeHelpers.matchCredentials(node);
|
||||
nodeHelpers.updateNodeParameterIssues(node);
|
||||
nodeHelpers.updateNodeCredentialIssues(node);
|
||||
nodeHelpers.updateNodeInputIssues(node);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1109,9 +1109,10 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, () => {
|
|||
}
|
||||
|
||||
workflow.value.nodes.push(nodeData);
|
||||
|
||||
// Init node metadata
|
||||
if (!nodeMetadata.value[nodeData.name]) {
|
||||
nodeMetadata.value[nodeData.name] = {} as INodeMetadata;
|
||||
setNodeMetadata(nodeData.name, {} as INodeMetadata);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1557,6 +1558,10 @@ 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;
|
||||
}
|
||||
|
@ -1749,6 +1754,7 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, () => {
|
|||
deleteExecution,
|
||||
addToCurrentExecutions,
|
||||
getBinaryUrl,
|
||||
setNodeMetadata,
|
||||
setNodePristine,
|
||||
resetChatMessages,
|
||||
appendChatMessage,
|
||||
|
|
Loading…
Reference in a new issue