mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 12:57:29 -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;
|
||||
trackHistory?: boolean;
|
||||
isAutoAdd?: boolean;
|
||||
telemetry?: boolean;
|
||||
};
|
||||
|
||||
export function useCanvasOperations({ router }: { router: ReturnType<typeof useRouter> }) {
|
||||
|
@ -434,6 +435,7 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
|
|||
trackHistory?: boolean;
|
||||
trackBulk?: boolean;
|
||||
keepPristine?: boolean;
|
||||
telemetry?: boolean;
|
||||
} = {},
|
||||
) {
|
||||
let insertPosition = options.position;
|
||||
|
@ -474,7 +476,6 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
|
|||
...options,
|
||||
openNDV,
|
||||
isAutoAdd,
|
||||
trackHistory: options.trackHistory,
|
||||
},
|
||||
);
|
||||
} catch (error) {
|
||||
|
@ -555,7 +556,13 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
|
|||
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) {
|
||||
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) {
|
||||
case STICKY_NODE_TYPE:
|
||||
trackAddStickyNoteNode();
|
||||
break;
|
||||
default:
|
||||
void externalHooks.run('nodeView.addNodeButton', { nodeTypeName: nodeData.type });
|
||||
trackAddDefaultNode(nodeData, options);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -809,7 +809,7 @@ async function onAddNodesAndConnections(
|
|||
return;
|
||||
}
|
||||
|
||||
await addNodes(nodes, { dragAndDrop, position, trackHistory: true });
|
||||
await addNodes(nodes, { dragAndDrop, position, trackHistory: true, telemetry: true });
|
||||
await nextTick();
|
||||
|
||||
const offsetIndex = editableWorkflow.value.nodes.length - nodes.length;
|
||||
|
|
Loading…
Reference in a new issue