Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(editor): Improve performance when opening large workflows with node issues #7901

Merged
merged 4 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cypress/e2e/28-debug.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 3 additions & 0 deletions packages/editor-ui/src/mixins/genericHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export const genericHelpers = defineComponent({
readOnlyEnv(): boolean {
return this.sourceControlStore.preferences.branchReadOnly;
},
isLoading(): boolean {
MiloradFilipovic marked this conversation as resolved.
Show resolved Hide resolved
return this.loadingService !== null;
},
},
methods: {
displayTimer(msPassed: number, showMs = false): string {
Expand Down
5 changes: 3 additions & 2 deletions packages/editor-ui/src/mixins/nodeHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
}
Expand All @@ -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 || {});
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/src/mixins/workflowHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
14 changes: 8 additions & 6 deletions packages/editor-ui/src/views/NodeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down
Loading