mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
fix(editor): Unbind workflow endpoint events in case of workspace reset (#7129)
This commit is contained in:
@@ -2531,15 +2531,18 @@ export default defineComponent({
|
||||
this.instance.unbind(EVENT_CONNECTION_ABORT, this.onConnectionDragAbortDetached);
|
||||
this.instance.unbind(EVENT_CONNECTION_DETACHED, this.onConnectionDragAbortDetached);
|
||||
this.instance.unbind(EVENT_PLUS_ENDPOINT_CLICK, this.onPlusEndpointClick);
|
||||
|
||||
// Get all the endpoints and unbind the events
|
||||
const elements = this.instance.getManagedElements();
|
||||
for (const element of Object.values(elements)) {
|
||||
const endpoints = element.endpoints;
|
||||
for (const endpoint of endpoints || []) {
|
||||
const endpointInstance = endpoint?.endpoint;
|
||||
if (endpointInstance && endpointInstance.type === N8nPlusEndpointType) {
|
||||
(endpointInstance as N8nPlusEndpoint).unbindEvents();
|
||||
},
|
||||
unbindEndpointEventListeners(bind = true) {
|
||||
if (this.instance) {
|
||||
// Get all the endpoints and unbind the events
|
||||
const elements = this.instance.getManagedElements();
|
||||
for (const element of Object.values(elements)) {
|
||||
const endpoints = element.endpoints;
|
||||
for (const endpoint of endpoints || []) {
|
||||
const endpointInstance = endpoint?.endpoint;
|
||||
if (endpointInstance && endpointInstance.type === N8nPlusEndpointType) {
|
||||
(endpointInstance as N8nPlusEndpoint).unbindEvents();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3575,6 +3578,7 @@ export default defineComponent({
|
||||
this.nodeCreatorStore.setShowScrim(false);
|
||||
|
||||
// Reset nodes
|
||||
this.unbindEndpointEventListeners();
|
||||
this.deleteEveryEndpoint();
|
||||
|
||||
// Make sure that if there is a waiting test-webhook that it gets removed
|
||||
|
||||
Reference in New Issue
Block a user