Skip to content

Commit 4635d72

Browse files
authored
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.
1 parent 3ff6c7b commit 4635d72

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

app/src/resources/__tests__/useNotifyService.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { useNotifyService } from '../useNotifyService'
88
import { appShellListener } from '../../redux/shell/remote'
99
import { useTrackEvent } from '../../redux/analytics'
1010
import { notifySubscribeAction } from '../../redux/shell'
11-
import { useIsFlex } from '../../organisms/Devices/hooks/useIsFlex'
1211

1312
import type { Mock } from 'vitest'
1413
import type { HostConfig } from '@opentrons/api-client'
@@ -21,7 +20,6 @@ vi.mock('../../redux/analytics')
2120
vi.mock('../../redux/shell/remote', () => ({
2221
appShellListener: vi.fn(),
2322
}))
24-
vi.mock('../../organisms/Devices/hooks/useIsFlex')
2523

2624
const MOCK_HOST_CONFIG: HostConfig = { hostname: 'MOCK_HOST' }
2725
const MOCK_TOPIC = '/test/topic' as any
@@ -41,7 +39,6 @@ describe('useNotifyService', () => {
4139
vi.mocked(useTrackEvent).mockReturnValue(mockTrackEvent)
4240
vi.mocked(useDispatch).mockReturnValue(mockDispatch)
4341
vi.mocked(useHost).mockReturnValue(MOCK_HOST_CONFIG)
44-
vi.mocked(useIsFlex).mockReturnValue(true)
4542
vi.mocked(appShellListener).mockClear()
4643
})
4744

app/src/resources/useNotifyService.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
useTrackEvent,
1111
ANALYTICS_NOTIFICATION_PORT_BLOCK_ERROR,
1212
} from '../redux/analytics'
13-
import { useIsFlex } from '../organisms/Devices/hooks/useIsFlex'
1413

1514
import type { UseQueryOptions } from 'react-query'
1615
import type { HostConfig } from '@opentrons/api-client'
@@ -41,7 +40,6 @@ export function useNotifyService<TData, TError = Error>({
4140
const host = hostOverride ?? hostFromProvider
4241
const hostname = host?.hostname ?? null
4342
const doTrackEvent = useTrackEvent()
44-
const isFlex = useIsFlex(host?.robotName ?? '')
4543
const seenHostname = React.useRef<string | null>(null)
4644
const { enabled, staleTime, forceHttpPolling } = options
4745

@@ -81,8 +79,7 @@ export function useNotifyService<TData, TError = Error>({
8179
function onDataEvent(data: NotifyResponseData): void {
8280
if (data === 'ECONNFAILED' || data === 'ECONNREFUSED') {
8381
setRefetch('always')
84-
// TODO(jh 2023-02-23): remove the robot type check once OT-2s support MQTT.
85-
if (data === 'ECONNREFUSED' && isFlex) {
82+
if (data === 'ECONNREFUSED') {
8683
doTrackEvent({
8784
name: ANALYTICS_NOTIFICATION_PORT_BLOCK_ERROR,
8885
properties: {},

0 commit comments

Comments
 (0)