mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 21:07:28 -08:00
fix(editor): Stop telemetry from triggering when initializing workflow in new canvas (no-changelog) (#10492)
This commit is contained in:
parent
d4012c7bf8
commit
d5acde5ce4
|
@ -105,6 +105,7 @@ type AddNodeOptions = {
|
||||||
openNDV?: boolean;
|
openNDV?: boolean;
|
||||||
trackHistory?: boolean;
|
trackHistory?: boolean;
|
||||||
isAutoAdd?: boolean;
|
isAutoAdd?: boolean;
|
||||||
|
telemetry?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function useCanvasOperations({ router }: { router: ReturnType<typeof useRouter> }) {
|
export function useCanvasOperations({ router }: { router: ReturnType<typeof useRouter> }) {
|
||||||
|
@ -434,6 +435,7 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
|
||||||
trackHistory?: boolean;
|
trackHistory?: boolean;
|
||||||
trackBulk?: boolean;
|
trackBulk?: boolean;
|
||||||
keepPristine?: boolean;
|
keepPristine?: boolean;
|
||||||
|
telemetry?: boolean;
|
||||||
} = {},
|
} = {},
|
||||||
) {
|
) {
|
||||||
let insertPosition = options.position;
|
let insertPosition = options.position;
|
||||||
|
@ -474,7 +476,6 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
|
||||||
...options,
|
...options,
|
||||||
openNDV,
|
openNDV,
|
||||||
isAutoAdd,
|
isAutoAdd,
|
||||||
trackHistory: options.trackHistory,
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -555,7 +556,13 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
|
||||||
createConnectionToLastInteractedWithNode(nodeData, options);
|
createConnectionToLastInteractedWithNode(nodeData, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
runAddNodeHooks(nodeData, options);
|
if (options.telemetry) {
|
||||||
|
trackAddNode(nodeData, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nodeData.type !== STICKY_NODE_TYPE) {
|
||||||
|
void externalHooks.run('nodeView.addNodeButton', { nodeTypeName: nodeData.type });
|
||||||
|
}
|
||||||
|
|
||||||
if (options.openNDV && !preventOpeningNDV) {
|
if (options.openNDV && !preventOpeningNDV) {
|
||||||
ndvStore.setActiveNodeName(nodeData.name);
|
ndvStore.setActiveNodeName(nodeData.name);
|
||||||
|
@ -652,13 +659,12 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function runAddNodeHooks(nodeData: INodeUi, options: AddNodeOptions) {
|
function trackAddNode(nodeData: INodeUi, options: AddNodeOptions) {
|
||||||
switch (nodeData.type) {
|
switch (nodeData.type) {
|
||||||
case STICKY_NODE_TYPE:
|
case STICKY_NODE_TYPE:
|
||||||
trackAddStickyNoteNode();
|
trackAddStickyNoteNode();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
void externalHooks.run('nodeView.addNodeButton', { nodeTypeName: nodeData.type });
|
|
||||||
trackAddDefaultNode(nodeData, options);
|
trackAddDefaultNode(nodeData, options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -809,7 +809,7 @@ async function onAddNodesAndConnections(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await addNodes(nodes, { dragAndDrop, position, trackHistory: true });
|
await addNodes(nodes, { dragAndDrop, position, trackHistory: true, telemetry: true });
|
||||||
await nextTick();
|
await nextTick();
|
||||||
|
|
||||||
const offsetIndex = editableWorkflow.value.nodes.length - nodes.length;
|
const offsetIndex = editableWorkflow.value.nodes.length - nodes.length;
|
||||||
|
|
Loading…
Reference in a new issue