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
Changes from 1 commit
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
20 changes: 14 additions & 6 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 !== false) {
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 Expand Up @@ -1244,7 +1250,7 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
workflowHelpers.initState(data);

// Add nodes and connections
await addNodes(data.nodes, { keepPristine: true });
await addNodes(data.nodes, { keepPristine: true, telemetry: false });
workflowsStore.setConnections(data.connections);
}

Expand Down Expand Up @@ -1412,7 +1418,9 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
// Add the nodes with the changed node names, expressions and connections
historyStore.startRecordingUndo();

await addNodes(Object.values(tempWorkflow.nodes));
await addNodes(Object.values(tempWorkflow.nodes), {
telemetry: false,
});
addConnections(
mapLegacyConnectionsToCanvasConnections(
tempWorkflow.connectionsBySourceNode,
Expand Down