From e14743d4b57cae3a0803f21375451214c58f274c Mon Sep 17 00:00:00 2001 From: Mike Heneghan Date: Tue, 9 Jan 2024 17:09:47 +0000 Subject: [PATCH] fix: track the node type as text rather than integer for new records - The node types as text are easier to interpret in analytics_logs --- .../src/pages/FlowEditor/lib/analyticsProvider.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/editor.planx.uk/src/pages/FlowEditor/lib/analyticsProvider.tsx b/editor.planx.uk/src/pages/FlowEditor/lib/analyticsProvider.tsx index 1b23fe861a..5595fcad26 100644 --- a/editor.planx.uk/src/pages/FlowEditor/lib/analyticsProvider.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/lib/analyticsProvider.tsx @@ -32,7 +32,7 @@ type NodeMetadata = { }; flag?: Flag; title?: string; - type?: TYPES; + type?: string | null; id?: string; isAutoAnswered?: boolean; }; @@ -434,9 +434,10 @@ export const AnalyticsProvider: React.FC<{ children: React.ReactNode }> = ({ function getTargetNodeDataFromFlow(nodeId: string) { const node = flow[nodeId]; + const nodeType = node?.type ? TYPES[node.type] : null; const nodeMetadata: NodeMetadata = { title: extractNodeTitle(node), - type: node.type, + type: nodeType, id: nodeId, }; return nodeMetadata;