Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(editor): Stop telemetry from triggering when initializing workflow in new canvas (no-changelog) #10492

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions packages/editor-ui/src/composables/useCanvasOperations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ type AddNodeOptions = {
openNDV?: boolean;
trackHistory?: boolean;
isAutoAdd?: boolean;
telemetry?: boolean;
};

export function useCanvasOperations({ router }: { router: ReturnType<typeof useRouter> }) {
Expand Down Expand Up @@ -434,6 +435,7 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
trackHistory?: boolean;
trackBulk?: boolean;
keepPristine?: boolean;
telemetry?: boolean;
} = {},
) {
let insertPosition = options.position;
Expand Down Expand Up @@ -474,7 +476,6 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
...options,
openNDV,
isAutoAdd,
trackHistory: options.trackHistory,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...options spread above is already adding the fields.

},
);
} catch (error) {
Expand Down Expand Up @@ -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 });
}
Comment on lines +563 to +565
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


if (options.openNDV && !preventOpeningNDV) {
ndvStore.setActiveNodeName(nodeData.name);
Expand Down Expand Up @@ -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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/src/views/NodeView.v2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,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;
Expand Down
Loading