mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -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(() => {
|
void nextTick(() => {
|
||||||
workflowsStore.setNodePristine(nodeData.name, true);
|
|
||||||
|
|
||||||
if (!options.keepPristine) {
|
if (!options.keepPristine) {
|
||||||
uiStore.stateIsDirty = true;
|
uiStore.stateIsDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
workflowsStore.setNodePristine(nodeData.name, true);
|
||||||
nodeHelpers.matchCredentials(nodeData);
|
nodeHelpers.matchCredentials(nodeData);
|
||||||
nodeHelpers.updateNodeParameterIssues(nodeData);
|
nodeHelpers.updateNodeParameterIssues(nodeData);
|
||||||
nodeHelpers.updateNodeCredentialIssues(nodeData);
|
nodeHelpers.updateNodeCredentialIssues(nodeData);
|
||||||
|
@ -1381,11 +1380,17 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
|
||||||
async function initializeWorkspace(data: IWorkflowDb) {
|
async function initializeWorkspace(data: IWorkflowDb) {
|
||||||
// Set workflow data
|
// Set workflow data
|
||||||
workflowHelpers.initState(data);
|
workflowHelpers.initState(data);
|
||||||
|
workflowsStore.workflow.nodes = data.nodes;
|
||||||
|
workflowsStore.workflow.connections = data.connections;
|
||||||
|
|
||||||
// Add nodes and connections
|
void nextTick(() => {
|
||||||
await addNodes(data.nodes, { keepPristine: true });
|
workflowsStore.workflow.nodes.forEach((node) => {
|
||||||
await addConnections(mapLegacyConnectionsToCanvasConnections(data.connections, data.nodes), {
|
workflowsStore.setNodeMetadata(node.name, { pristine: true });
|
||||||
keepPristine: 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);
|
workflow.value.nodes.push(nodeData);
|
||||||
|
|
||||||
// Init node metadata
|
// Init node metadata
|
||||||
if (!nodeMetadata.value[nodeData.name]) {
|
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();
|
return url.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setNodeMetadata(nodeName: string, metadata: INodeMetadata): void {
|
||||||
|
nodeMetadata.value[nodeName] = metadata;
|
||||||
|
}
|
||||||
|
|
||||||
function setNodePristine(nodeName: string, isPristine: boolean): void {
|
function setNodePristine(nodeName: string, isPristine: boolean): void {
|
||||||
nodeMetadata.value[nodeName].pristine = isPristine;
|
nodeMetadata.value[nodeName].pristine = isPristine;
|
||||||
}
|
}
|
||||||
|
@ -1749,6 +1754,7 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, () => {
|
||||||
deleteExecution,
|
deleteExecution,
|
||||||
addToCurrentExecutions,
|
addToCurrentExecutions,
|
||||||
getBinaryUrl,
|
getBinaryUrl,
|
||||||
|
setNodeMetadata,
|
||||||
setNodePristine,
|
setNodePristine,
|
||||||
resetChatMessages,
|
resetChatMessages,
|
||||||
appendChatMessage,
|
appendChatMessage,
|
||||||
|
|
Loading…
Reference in a new issue