From 4635d725143bafdfacbfc9b1d809a4fc21b8008f Mon Sep 17 00:00:00 2001 From: Jamey Huffnagle Date: Wed, 1 May 2024 14:22:01 -0400 Subject: [PATCH] refactor(app): generify MQTT Analytics (#15065) Now that the OT-2 supports MQTT, we don't need to special-case analytics for only the Flex. --- app/src/resources/__tests__/useNotifyService.test.ts | 3 --- app/src/resources/useNotifyService.ts | 5 +---- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/app/src/resources/__tests__/useNotifyService.test.ts b/app/src/resources/__tests__/useNotifyService.test.ts index ce513e3e572..f2bf6bb516f 100644 --- a/app/src/resources/__tests__/useNotifyService.test.ts +++ b/app/src/resources/__tests__/useNotifyService.test.ts @@ -8,7 +8,6 @@ import { useNotifyService } from '../useNotifyService' import { appShellListener } from '../../redux/shell/remote' import { useTrackEvent } from '../../redux/analytics' import { notifySubscribeAction } from '../../redux/shell' -import { useIsFlex } from '../../organisms/Devices/hooks/useIsFlex' import type { Mock } from 'vitest' import type { HostConfig } from '@opentrons/api-client' @@ -21,7 +20,6 @@ vi.mock('../../redux/analytics') vi.mock('../../redux/shell/remote', () => ({ appShellListener: vi.fn(), })) -vi.mock('../../organisms/Devices/hooks/useIsFlex') const MOCK_HOST_CONFIG: HostConfig = { hostname: 'MOCK_HOST' } const MOCK_TOPIC = '/test/topic' as any @@ -41,7 +39,6 @@ describe('useNotifyService', () => { vi.mocked(useTrackEvent).mockReturnValue(mockTrackEvent) vi.mocked(useDispatch).mockReturnValue(mockDispatch) vi.mocked(useHost).mockReturnValue(MOCK_HOST_CONFIG) - vi.mocked(useIsFlex).mockReturnValue(true) vi.mocked(appShellListener).mockClear() }) diff --git a/app/src/resources/useNotifyService.ts b/app/src/resources/useNotifyService.ts index 19831dc9c62..d8422ba786f 100644 --- a/app/src/resources/useNotifyService.ts +++ b/app/src/resources/useNotifyService.ts @@ -10,7 +10,6 @@ import { useTrackEvent, ANALYTICS_NOTIFICATION_PORT_BLOCK_ERROR, } from '../redux/analytics' -import { useIsFlex } from '../organisms/Devices/hooks/useIsFlex' import type { UseQueryOptions } from 'react-query' import type { HostConfig } from '@opentrons/api-client' @@ -41,7 +40,6 @@ export function useNotifyService({ const host = hostOverride ?? hostFromProvider const hostname = host?.hostname ?? null const doTrackEvent = useTrackEvent() - const isFlex = useIsFlex(host?.robotName ?? '') const seenHostname = React.useRef(null) const { enabled, staleTime, forceHttpPolling } = options @@ -81,8 +79,7 @@ export function useNotifyService({ function onDataEvent(data: NotifyResponseData): void { if (data === 'ECONNFAILED' || data === 'ECONNREFUSED') { setRefetch('always') - // TODO(jh 2023-02-23): remove the robot type check once OT-2s support MQTT. - if (data === 'ECONNREFUSED' && isFlex) { + if (data === 'ECONNREFUSED') { doTrackEvent({ name: ANALYTICS_NOTIFICATION_PORT_BLOCK_ERROR, properties: {},