fix(editor): Drop outgoing connections on order changed event for nodes with dynamic outputs (#9055)

This commit is contained in:
Michael Kret
2024-04-09 04:46:52 +03:00
committed by GitHub
parent 936682eeaa
commit 3dd70a17e2
8 changed files with 304 additions and 2 deletions

View File

@@ -200,6 +200,12 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, {
return {};
};
},
nodeHasOutputConnection() {
return (nodeName: string): boolean => {
if (this.workflow.connections.hasOwnProperty(nodeName)) return true;
return false;
};
},
isNodeInOutgoingNodeConnections() {
return (firstNode: string, secondNode: string): boolean => {
const firstNodeConnections = this.outgoingConnectionsByNodeName(firstNode);
@@ -841,15 +847,19 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, {
this.workflow.connections = {};
},
removeAllNodeConnection(node: INodeUi): void {
removeAllNodeConnection(
node: INodeUi,
{ preserveInputConnections = false, preserveOutputConnections = false } = {},
): void {
const uiStore = useUIStore();
uiStore.stateIsDirty = true;
// Remove all source connections
if (this.workflow.connections.hasOwnProperty(node.name)) {
if (!preserveOutputConnections && this.workflow.connections.hasOwnProperty(node.name)) {
delete this.workflow.connections[node.name];
}
// Remove all destination connections
if (preserveInputConnections) return;
const indexesToRemove = [];
let sourceNode: string,
type: string,