From 99da2524454ba535e59cb2dd3e54d40d4a451489 Mon Sep 17 00:00:00 2001 From: Jethary Alcid <66035149+jerader@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:06:40 -0500 Subject: [PATCH] fix(protocol-designer): timeline errors/warnings show up in mixpanel (#17164) closes RQA-3778 --- .../reduxActionToAnalyticsEvent.test.ts | 7 ++++--- protocol-designer/src/analytics/middleware.ts | 17 ++++++++++++----- protocol-designer/src/configureStore.ts | 4 ++-- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/protocol-designer/src/analytics/__tests__/reduxActionToAnalyticsEvent.test.ts b/protocol-designer/src/analytics/__tests__/reduxActionToAnalyticsEvent.test.ts index 5f5c9aa4012..cecf0755c0a 100644 --- a/protocol-designer/src/analytics/__tests__/reduxActionToAnalyticsEvent.test.ts +++ b/protocol-designer/src/analytics/__tests__/reduxActionToAnalyticsEvent.test.ts @@ -154,9 +154,10 @@ describe('reduxActionToAnalyticsEvent', () => { id: 'stepId', pipette: 'pipetteId', otherField: 123, - aspirateFlowRate: undefined, - dispenseFlowRate: undefined, - aspirateAirGap: undefined, + aspirateFlowRate: 'default', + dispenseFlowRate: 'default', + aspirateAirGap: 'default', + dispenseAirGap: 'default', nested: { inner: true }, // de-nested fields __nested__inner: true, diff --git a/protocol-designer/src/analytics/middleware.ts b/protocol-designer/src/analytics/middleware.ts index 29cc66f8a11..661bb2a65ff 100644 --- a/protocol-designer/src/analytics/middleware.ts +++ b/protocol-designer/src/analytics/middleware.ts @@ -158,9 +158,14 @@ export const reduxActionToAnalyticsEvent = ( name: `${modifiedStepName}Step`, properties: { ...stepArgModified, - aspirateAirGap: stepArgModified.aspirateAirGapVolume, - aspirateFlowRate: stepArgModified.aspirateFlowRateUlSec, - dispenseFlowRate: stepArgModified.dispenseFlowRateUlSec, + aspirateAirGap: + stepArgModified.aspirateAirGapVolume ?? DEFAULT_VALUE, + aspirateFlowRate: + stepArgModified.aspirateFlowRateUlSec ?? DEFAULT_VALUE, + dispenseFlowRate: + stepArgModified.dispenseFlowRateUlSec ?? DEFAULT_VALUE, + dispenseAirGap: + stepArgModified.dispenseAirGapVolume ?? DEFAULT_VALUE, blowoutFlowRate: stepArgModified.blowoutFlowRateUlSec, aspirateOffsetFromBottomMm: stepArgModified.aspirateOffsetFromBottomMm === @@ -202,8 +207,10 @@ export const reduxActionToAnalyticsEvent = ( name: `mixStep`, properties: { ...stepArgModified, - aspirateFlowRate: stepArgModified.aspirateFlowRateUlSec, - dispenseFlowRate: stepArgModified.dispenseFlowRateUlSec, + aspirateFlowRate: + stepArgModified.aspirateFlowRateUlSec ?? DEFAULT_VALUE, + dispenseFlowRate: + stepArgModified.dispenseFlowRateUlSec ?? DEFAULT_VALUE, blowoutFlowRate: stepArgModified.blowoutFlowRateUlSec, aspirateOffsetFromBottomMm: stepArgModified.aspirateOffsetFromBottomMm === diff --git a/protocol-designer/src/configureStore.ts b/protocol-designer/src/configureStore.ts index f7c31f00810..9f049628c0a 100644 --- a/protocol-designer/src/configureStore.ts +++ b/protocol-designer/src/configureStore.ts @@ -89,9 +89,9 @@ export function configureStore(): StoreType { /* preloadedState, */ composeEnhancers( applyMiddleware( - trackEventMiddleware as Middleware, any>, + thunk, timelineMiddleware as Middleware, any>, - thunk + trackEventMiddleware as Middleware, any> ) ) as StoreEnhancer )