From c5f636d17f263269a688afd4753014122ee0f1cb Mon Sep 17 00:00:00 2001 From: Milorad Filipovic Date: Fri, 1 Dec 2023 14:37:15 +0100 Subject: [PATCH 1/3] perf(editor): Speed up opening workflows with node issues --- cypress/e2e/28-debug.cy.ts | 1 + packages/editor-ui/src/mixins/genericHelpers.ts | 3 +++ packages/editor-ui/src/views/NodeView.vue | 14 ++++++++------ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/cypress/e2e/28-debug.cy.ts b/cypress/e2e/28-debug.cy.ts index 953cdd5f521f7..699f07d53ff63 100644 --- a/cypress/e2e/28-debug.cy.ts +++ b/cypress/e2e/28-debug.cy.ts @@ -126,6 +126,7 @@ describe('Debug', () => { cy.url().should('not.include', '/debug'); workflowPage.actions.executeWorkflow(); + workflowPage.actions.zoomToFit(); workflowPage.actions.deleteNode(IF_NODE_NAME); executionsTab.actions.switchToExecutionsTab(); diff --git a/packages/editor-ui/src/mixins/genericHelpers.ts b/packages/editor-ui/src/mixins/genericHelpers.ts index 826814c8378e4..59cd53bd5e788 100644 --- a/packages/editor-ui/src/mixins/genericHelpers.ts +++ b/packages/editor-ui/src/mixins/genericHelpers.ts @@ -29,6 +29,9 @@ export const genericHelpers = defineComponent({ readOnlyEnv(): boolean { return this.sourceControlStore.preferences.branchReadOnly; }, + isLoading(): boolean { + return this.loadingService !== null; + }, }, methods: { displayTimer(msPassed: number, showMs = false): string { diff --git a/packages/editor-ui/src/views/NodeView.vue b/packages/editor-ui/src/views/NodeView.vue index 06e4186cc0ec9..888110341e4bd 100644 --- a/packages/editor-ui/src/views/NodeView.vue +++ b/packages/editor-ui/src/views/NodeView.vue @@ -2693,10 +2693,6 @@ export default defineComponent({ this.dropPrevented = true; this.workflowsStore.addConnection({ connection: connectionData }); - this.uiStore.stateIsDirty = true; - if (!this.suspendRecordingDetachedConnections) { - this.historyStore.pushCommandToUndo(new AddConnectionCommand(connectionData)); - } if (!this.isReadOnlyRoute && !this.readOnlyEnv) { NodeViewUtils.hideOutputNameLabel(info.sourceEndpoint); @@ -2738,8 +2734,14 @@ export default defineComponent({ } } this.dropPrevented = false; - this.updateNodesInputIssues(); - this.resetEndpointsErrors(); + if (!this.isLoading) { + this.uiStore.stateIsDirty = true; + if (!this.suspendRecordingDetachedConnections) { + this.historyStore.pushCommandToUndo(new AddConnectionCommand(connectionData)); + } + this.updateNodesInputIssues(); + this.resetEndpointsErrors(); + } } catch (e) { console.error(e); } From 8fc2db1ed5e4a0e56169a2c69a0bcd63e59eed15 Mon Sep 17 00:00:00 2001 From: Milorad Filipovic Date: Fri, 1 Dec 2023 14:48:40 +0100 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=90=8E=20Prevent=20fetching=20current?= =?UTF-8?q?=20workflow=20for=20each=20node=20when=20processing=20node=20is?= =?UTF-8?q?sues?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor-ui/src/mixins/nodeHelpers.ts | 5 +++-- packages/editor-ui/src/mixins/workflowHelpers.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/editor-ui/src/mixins/nodeHelpers.ts b/packages/editor-ui/src/mixins/nodeHelpers.ts index 3c0999a04ab5a..c753a4f7f4d3c 100644 --- a/packages/editor-ui/src/mixins/nodeHelpers.ts +++ b/packages/editor-ui/src/mixins/nodeHelpers.ts @@ -91,6 +91,7 @@ export const nodeHelpers = defineComponent({ // Updates all the issues on all the nodes refreshNodeIssues(): void { const nodes = this.workflowsStore.allNodes; + const workflow = this.workflowsStore.getCurrentWorkflow(); let nodeType: INodeTypeDescription | null; let foundNodeIssues: INodeIssues | null; @@ -99,7 +100,7 @@ export const nodeHelpers = defineComponent({ return; } nodeType = this.nodeTypesStore.getNodeType(node.type, node.typeVersion); - foundNodeIssues = this.getNodeIssues(nodeType, node); + foundNodeIssues = this.getNodeIssues(nodeType, node, workflow); if (foundNodeIssues !== null) { node.issues = foundNodeIssues; } @@ -110,6 +111,7 @@ export const nodeHelpers = defineComponent({ getNodeIssues( nodeType: INodeTypeDescription | null, node: INodeUi, + workflow: Workflow, ignoreIssues?: string[], ): INodeIssues | null { const pinDataNodeNames = Object.keys(this.workflowsStore.getPinData || {}); @@ -147,7 +149,6 @@ export const nodeHelpers = defineComponent({ } } - const workflow = this.workflowsStore.getCurrentWorkflow(); const nodeInputIssues = this.getNodeInputIssues(workflow, node, nodeType); if (nodeIssues === null) { nodeIssues = nodeInputIssues; diff --git a/packages/editor-ui/src/mixins/workflowHelpers.ts b/packages/editor-ui/src/mixins/workflowHelpers.ts index 71b7cad786792..c993389976390 100644 --- a/packages/editor-ui/src/mixins/workflowHelpers.ts +++ b/packages/editor-ui/src/mixins/workflowHelpers.ts @@ -605,7 +605,7 @@ export const workflowHelpers = defineComponent({ typeUnknown: true, }; } else { - nodeIssues = this.getNodeIssues(nodeType.description, node, ['execution']); + nodeIssues = this.getNodeIssues(nodeType.description, node, workflow, ['execution']); } if (nodeIssues !== null) { From 2b62b755e7beaf3f3a8d0e7c23f106632372ce9e Mon Sep 17 00:00:00 2001 From: Milorad Filipovic Date: Fri, 1 Dec 2023 17:26:26 +0100 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=91=8C=20Moving=20loading=20computed?= =?UTF-8?q?=20prop=20to=20NodeView=20from=20mixin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor-ui/src/mixins/genericHelpers.ts | 3 --- packages/editor-ui/src/views/NodeView.vue | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/editor-ui/src/mixins/genericHelpers.ts b/packages/editor-ui/src/mixins/genericHelpers.ts index 59cd53bd5e788..826814c8378e4 100644 --- a/packages/editor-ui/src/mixins/genericHelpers.ts +++ b/packages/editor-ui/src/mixins/genericHelpers.ts @@ -29,9 +29,6 @@ export const genericHelpers = defineComponent({ readOnlyEnv(): boolean { return this.sourceControlStore.preferences.branchReadOnly; }, - isLoading(): boolean { - return this.loadingService !== null; - }, }, methods: { displayTimer(msPassed: number, showMs = false): string { diff --git a/packages/editor-ui/src/views/NodeView.vue b/packages/editor-ui/src/views/NodeView.vue index 888110341e4bd..b1d44e4bdf766 100644 --- a/packages/editor-ui/src/views/NodeView.vue +++ b/packages/editor-ui/src/views/NodeView.vue @@ -691,6 +691,9 @@ export default defineComponent({ instance(): BrowserJsPlumbInstance { return this.canvasStore.jsPlumbInstance; }, + isLoading(): boolean { + return this.loadingService !== null; + }, }, data() { return {