fix(editor): Stop connection to last selected node when pasting on new canvas (no-changelog) (#11042)

This commit is contained in:
Alex Grozav
2024-10-03 15:01:04 +03:00
committed by GitHub
parent fc26c44f65
commit f9480e9f57
7 changed files with 100 additions and 195 deletions

View File

@@ -307,7 +307,7 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
}
if (uiStore.lastInteractedWithNodeId === id) {
uiStore.lastInteractedWithNodeId = null;
uiStore.lastInteractedWithNodeId = undefined;
}
connectAdjacentNodes(id, { trackHistory });
@@ -387,7 +387,7 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
function setNodeSelected(id?: string) {
if (!id) {
uiStore.lastInteractedWithNodeId = null;
uiStore.lastInteractedWithNodeId = undefined;
uiStore.lastSelectedNode = '';
return;
}
@@ -917,7 +917,7 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
position = [newNodeInsertPosition[0] + xOffset, newNodeInsertPosition[1] + yOffset];
uiStore.lastCancelledConnectionPosition = null;
uiStore.lastCancelledConnectionPosition = undefined;
} else if (lastInteractedWithNodeTypeDescription) {
// When
// - clicking the plus button of a node handle
@@ -1617,6 +1617,8 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
source: string,
importTags = true,
): Promise<IWorkflowDataUpdate> {
uiStore.resetLastInteractedWith();
// If it is JSON check if it looks on the first look like data we can use
if (!workflowData.hasOwnProperty('nodes') || !workflowData.hasOwnProperty('connections')) {
return {};