From a52c060d6709dda8334c26e36740d4be4b02e745 Mon Sep 17 00:00:00 2001 From: Brian Cooper Date: Fri, 5 Apr 2024 16:52:07 -0400 Subject: [PATCH 1/6] fix(app): fallback to current run command on ODD if run diverges from analysis In the case of a non-deterministic protocol, the running protocol screen of the on device display app will fall back to showing no command text at all, instead it should fall back to showing the current running command Closes PLAT-274 --- ...seLastRunCommandKey.ts => useLastRunCommand.ts} | 11 +++++------ .../CurrentRunningProtocolCommand.tsx | 6 ++++-- app/src/organisms/RunPreview/index.tsx | 6 +++--- app/src/pages/RunningProtocol/index.tsx | 14 +++++--------- app/src/resources/runs/index.ts | 2 +- ...RunCommandKey.ts => useNotifyLastRunCommand.ts} | 10 +++++----- 6 files changed, 23 insertions(+), 26 deletions(-) rename app/src/organisms/Devices/hooks/{useLastRunCommandKey.ts => useLastRunCommand.ts} (84%) rename app/src/resources/runs/{useNotifyLastRunCommandKey.ts => useNotifyLastRunCommand.ts} (68%) diff --git a/app/src/organisms/Devices/hooks/useLastRunCommandKey.ts b/app/src/organisms/Devices/hooks/useLastRunCommand.ts similarity index 84% rename from app/src/organisms/Devices/hooks/useLastRunCommandKey.ts rename to app/src/organisms/Devices/hooks/useLastRunCommand.ts index b51160abf2d..3c2616aa4e7 100644 --- a/app/src/organisms/Devices/hooks/useLastRunCommandKey.ts +++ b/app/src/organisms/Devices/hooks/useLastRunCommand.ts @@ -12,7 +12,7 @@ import { } from '@opentrons/api-client' import type { UseQueryOptions } from 'react-query' -import type { CommandsData } from '@opentrons/api-client' +import type { CommandsData, RunCommandSummary } from '@opentrons/api-client' const LIVE_RUN_STATUSES = [ RUN_STATUS_IDLE, @@ -26,10 +26,10 @@ const LIVE_RUN_STATUSES = [ ] const LIVE_RUN_COMMANDS_POLL_MS = 3000 -export function useLastRunCommandKey( +export function useLastRunCommand( runId: string, options: UseQueryOptions = {} -): string | null { +): RunCommandSummary | null { const runStatus = useRunStatus(runId) const { data: commandsData } = useAllCommandsQuery( runId, @@ -44,8 +44,7 @@ export function useLastRunCommandKey( ) return commandsData?.data?.[0]?.intent !== 'setup' - ? commandsData?.links?.current?.meta?.key ?? - commandsData?.data?.[0]?.key ?? - null + ? commandsData?.data?.[0] ?? null : null } + diff --git a/app/src/organisms/OnDeviceDisplay/RunningProtocol/CurrentRunningProtocolCommand.tsx b/app/src/organisms/OnDeviceDisplay/RunningProtocol/CurrentRunningProtocolCommand.tsx index 93895a9bc54..3f05733b8b7 100644 --- a/app/src/organisms/OnDeviceDisplay/RunningProtocol/CurrentRunningProtocolCommand.tsx +++ b/app/src/organisms/OnDeviceDisplay/RunningProtocol/CurrentRunningProtocolCommand.tsx @@ -34,7 +34,7 @@ import type { RobotType, RunTimeCommand, } from '@opentrons/shared-data' -import type { RunStatus } from '@opentrons/api-client' +import type { RunCommandSummary, RunStatus } from '@opentrons/api-client' import type { TrackProtocolRunEvent } from '../../Devices/hooks' import type { RobotAnalyticsData } from '../../../redux/analytics/types' @@ -121,6 +121,7 @@ interface CurrentRunningProtocolCommandProps { trackProtocolRunEvent: TrackProtocolRunEvent robotAnalyticsData: RobotAnalyticsData | null lastAnimatedCommand: string | null + lastRunCommand: RunCommandSummary | null updateLastAnimatedCommand: (newCommandKey: string) => void protocolName?: string currentRunCommandIndex?: number @@ -138,13 +139,14 @@ export function CurrentRunningProtocolCommand({ robotType, protocolName, currentRunCommandIndex, + lastRunCommand, lastAnimatedCommand, updateLastAnimatedCommand, }: CurrentRunningProtocolCommandProps): JSX.Element | null { const { t } = useTranslation('run_details') const currentCommand = robotSideAnalysis?.commands.find( (c: RunTimeCommand, index: number) => index === currentRunCommandIndex - ) + ) ?? lastRunCommand let shouldAnimate = true if (currentCommand?.key != null) { diff --git a/app/src/organisms/RunPreview/index.tsx b/app/src/organisms/RunPreview/index.tsx index a75257c1952..a35608eb589 100644 --- a/app/src/organisms/RunPreview/index.tsx +++ b/app/src/organisms/RunPreview/index.tsx @@ -19,7 +19,7 @@ import { } from '@opentrons/components' import { useMostRecentCompletedAnalysis } from '../LabwarePositionCheck/useMostRecentCompletedAnalysis' -import { useNotifyLastRunCommandKey } from '../../resources/runs' +import { useNotifyLastRunCommand } from '../../resources/runs' import { CommandText } from '../CommandText' import { Divider } from '../../atoms/structure' import { NAV_BAR_WIDTH } from '../../App/constants' @@ -42,9 +42,9 @@ export const RunPreviewComponent = ( const { t } = useTranslation('run_details') const robotSideAnalysis = useMostRecentCompletedAnalysis(runId) const viewPortRef = React.useRef(null) - const currentRunCommandKey = useNotifyLastRunCommandKey(runId, { + const currentRunCommandKey = useNotifyLastRunCommand(runId, { refetchInterval: LIVE_RUN_COMMANDS_POLL_MS, - }) + })?.key const [ isCurrentCommandVisible, setIsCurrentCommandVisible, diff --git a/app/src/pages/RunningProtocol/index.tsx b/app/src/pages/RunningProtocol/index.tsx index 2fc56806679..2b5139af43e 100644 --- a/app/src/pages/RunningProtocol/index.tsx +++ b/app/src/pages/RunningProtocol/index.tsx @@ -30,7 +30,7 @@ import { import { StepMeter } from '../../atoms/StepMeter' import { useMostRecentCompletedAnalysis } from '../../organisms/LabwarePositionCheck/useMostRecentCompletedAnalysis' import { - useNotifyLastRunCommandKey, + useNotifyLastRunCommand, useNotifyRunQuery, } from '../../resources/runs' import { InterventionModal } from '../../organisms/InterventionModal' @@ -92,12 +92,13 @@ export function RunningProtocol(): JSX.Element { const lastAnimatedCommand = React.useRef(null) const swipe = useSwipe() const robotSideAnalysis = useMostRecentCompletedAnalysis(runId) - const currentRunCommandKey = useNotifyLastRunCommandKey(runId, { + const lastRunCommand = useNotifyLastRunCommand(runId, { refetchInterval: LIVE_RUN_COMMANDS_POLL_MS, }) + const totalIndex = robotSideAnalysis?.commands.length const currentRunCommandIndex = robotSideAnalysis?.commands.findIndex( - c => c.key === currentRunCommandKey + c => c.key === lastRunCommand?.key ) const runStatus = useRunStatus(runId, { refetchInterval: RUN_STATUS_REFETCH_INTERVAL, @@ -135,12 +136,6 @@ export function RunningProtocol(): JSX.Element { } }, [currentOption, swipe, swipe.setSwipeType]) - const { data: allCommandsQueryData } = useAllCommandsQuery(runId, { - cursor: null, - pageLength: 1, - }) - const lastRunCommand = allCommandsQueryData?.data[0] ?? null - React.useEffect(() => { if ( lastRunCommand != null && @@ -215,6 +210,7 @@ export function RunningProtocol(): JSX.Element { protocolName={protocolName} runStatus={runStatus} currentRunCommandIndex={currentRunCommandIndex} + lastRunCommand={lastRunCommand} robotSideAnalysis={robotSideAnalysis} runTimerInfo={{ runStatus, startedAt, stoppedAt, completedAt }} lastAnimatedCommand={lastAnimatedCommand.current} diff --git a/app/src/resources/runs/index.ts b/app/src/resources/runs/index.ts index be5fabb4970..78fe1d01011 100644 --- a/app/src/resources/runs/index.ts +++ b/app/src/resources/runs/index.ts @@ -2,4 +2,4 @@ export * from './hooks' export * from './utils' export * from './useNotifyAllRunsQuery' export * from './useNotifyRunQuery' -export * from './useNotifyLastRunCommandKey' +export * from './useNotifyLastRunCommand' diff --git a/app/src/resources/runs/useNotifyLastRunCommandKey.ts b/app/src/resources/runs/useNotifyLastRunCommand.ts similarity index 68% rename from app/src/resources/runs/useNotifyLastRunCommandKey.ts rename to app/src/resources/runs/useNotifyLastRunCommand.ts index 9c908a70749..14c68944e43 100644 --- a/app/src/resources/runs/useNotifyLastRunCommandKey.ts +++ b/app/src/resources/runs/useNotifyLastRunCommand.ts @@ -1,18 +1,18 @@ import * as React from 'react' import { useNotifyService } from '../useNotifyService' -import { useLastRunCommandKey } from '../../organisms/Devices/hooks/useLastRunCommandKey' +import { useLastRunCommand } from '../../organisms/Devices/hooks/useLastRunCommand' -import type { CommandsData } from '@opentrons/api-client' +import type { CommandsData, RunCommandSummary } from '@opentrons/api-client' import type { QueryOptionsWithPolling, HTTPRefetchFrequency, } from '../useNotifyService' -export function useNotifyLastRunCommandKey( +export function useNotifyLastRunCommand( runId: string, options: QueryOptionsWithPolling = {} -): string | null { +): RunCommandSummary | null { const [refetch, setRefetch] = React.useState(null) useNotifyService({ @@ -21,7 +21,7 @@ export function useNotifyLastRunCommandKey( options, }) - const httpResponse = useLastRunCommandKey(runId, { + const httpResponse = useLastRunCommand(runId, { ...options, enabled: options?.enabled !== false && refetch != null, onSettled: refetch === 'once' ? () => setRefetch(null) : () => null, From fa5bcd9ba718d0d78b07fb1f10f6a16100f2284b Mon Sep 17 00:00:00 2001 From: Brian Cooper Date: Fri, 12 Apr 2024 15:41:58 -0400 Subject: [PATCH 2/6] patch odd dev mode with brents untested fix --- app-shell-odd/src/usb.ts | 79 ++++++++++++++----------- app/src/pages/RunningProtocol/index.tsx | 1 - 2 files changed, 44 insertions(+), 36 deletions(-) diff --git a/app-shell-odd/src/usb.ts b/app-shell-odd/src/usb.ts index 69629eff161..fee385c3e15 100644 --- a/app-shell-odd/src/usb.ts +++ b/app-shell-odd/src/usb.ts @@ -27,8 +27,8 @@ const enumerateMassStorage = (path: string): Promise => .then(entries => entries.length === 0 ? new Promise(resolve => - setTimeout(resolve, MOUNT_ENUMERATION_DELAY_MS) - ) + setTimeout(resolve, MOUNT_ENUMERATION_DELAY_MS) + ) : new Promise(resolve => resolve()) ) .then(() => fsPromises.readdir(path, { withFileTypes: true })) @@ -38,8 +38,8 @@ const enumerateMassStorage = (path: string): Promise => entry.isDirectory() && !isWeirdDirectoryAndShouldSkip(entry.name) ? enumerateMassStorage(join(path, entry.name)) : new Promise(resolve => - resolve([join(path, entry.name)]) - ) + resolve([join(path, entry.name)]) + ) ) ) ) @@ -90,40 +90,49 @@ export function watchForMassStorage(dispatch: Dispatch): () => void { prevDirs = present.filter((entry): entry is string => entry !== null) }) - const mediaWatcher = fs.watch( - FLEX_USB_MOUNT_DIR, - { persistent: true }, - (event, fileName) => { - if (!!!fileName) { - rescan(dispatch) - return - } - if (!fileName.match(FLEX_USB_MOUNT_FILTER)) { - return - } - const fullPath = join(FLEX_USB_MOUNT_DIR, fileName) - fsPromises - .stat(fullPath) - .then(info => { - if (!info.isDirectory) { + + const mediaWatcherCreator = (): fs.FSWatcher | null => { + try { + return fs.watch( + FLEX_USB_MOUNT_DIR, + { persistent: true }, + (event, fileName) => { + if (!!!fileName) { + rescan(dispatch) return } - if (prevDirs.includes(fullPath)) { + if (!fileName.match(FLEX_USB_MOUNT_FILTER)) { return } - console.log(`New mass storage device ${fileName} detected`) - prevDirs.push(fullPath) - return handleNewlyPresent(fullPath) - }) - .catch(() => { - if (prevDirs.includes(fullPath)) { - console.log(`Mass storage device at ${fileName} removed`) - prevDirs = prevDirs.filter(entry => entry !== fullPath) - dispatch(robotMassStorageDeviceRemoved(fullPath)) - } - }) + const fullPath = join(FLEX_USB_MOUNT_DIR, fileName) + fsPromises + .stat(fullPath) + .then(info => { + if (!info.isDirectory) { + return + } + if (prevDirs.includes(fullPath)) { + return + } + console.log(`New mass storage device ${fileName} detected`) + prevDirs.push(fullPath) + return handleNewlyPresent(fullPath) + }) + .catch(() => { + if (prevDirs.includes(fullPath)) { + console.log(`Mass storage device at ${fileName} removed`) + prevDirs = prevDirs.filter(entry => entry !== fullPath) + dispatch(robotMassStorageDeviceRemoved(fullPath)) + } + }) + } + ) + } catch { + return null } - ) + } + + const mediaWatcher = mediaWatcherCreator() const devWatcher = fs.watch( FLEX_USB_DEVICE_DIR, @@ -142,7 +151,7 @@ export function watchForMassStorage(dispatch: Dispatch): () => void { ) // we don't care if this fails because it's racing the system removing // the mount dir in the common case - fsPromises.unlink(mountPath).catch(() => {}) + fsPromises.unlink(mountPath).catch(() => { }) } }) } @@ -150,7 +159,7 @@ export function watchForMassStorage(dispatch: Dispatch): () => void { rescan(dispatch) return () => { - mediaWatcher.close() + mediaWatcher != null && mediaWatcher.close() devWatcher.close() } } diff --git a/app/src/pages/RunningProtocol/index.tsx b/app/src/pages/RunningProtocol/index.tsx index 97720f0aa6f..dcacf61ab34 100644 --- a/app/src/pages/RunningProtocol/index.tsx +++ b/app/src/pages/RunningProtocol/index.tsx @@ -18,7 +18,6 @@ import { useSwipe, } from '@opentrons/components' import { - useAllCommandsQuery, useProtocolQuery, useRunActionMutations, } from '@opentrons/react-api-client' From 1ba14959da17d8bc8b12321a44b14d10a03e0276 Mon Sep 17 00:00:00 2001 From: Brian Cooper Date: Wed, 1 May 2024 14:53:07 -0400 Subject: [PATCH 3/6] revert usb.ts change --- app-shell-odd/src/usb.ts | 79 ++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 44 deletions(-) diff --git a/app-shell-odd/src/usb.ts b/app-shell-odd/src/usb.ts index fee385c3e15..69629eff161 100644 --- a/app-shell-odd/src/usb.ts +++ b/app-shell-odd/src/usb.ts @@ -27,8 +27,8 @@ const enumerateMassStorage = (path: string): Promise => .then(entries => entries.length === 0 ? new Promise(resolve => - setTimeout(resolve, MOUNT_ENUMERATION_DELAY_MS) - ) + setTimeout(resolve, MOUNT_ENUMERATION_DELAY_MS) + ) : new Promise(resolve => resolve()) ) .then(() => fsPromises.readdir(path, { withFileTypes: true })) @@ -38,8 +38,8 @@ const enumerateMassStorage = (path: string): Promise => entry.isDirectory() && !isWeirdDirectoryAndShouldSkip(entry.name) ? enumerateMassStorage(join(path, entry.name)) : new Promise(resolve => - resolve([join(path, entry.name)]) - ) + resolve([join(path, entry.name)]) + ) ) ) ) @@ -90,49 +90,40 @@ export function watchForMassStorage(dispatch: Dispatch): () => void { prevDirs = present.filter((entry): entry is string => entry !== null) }) - - const mediaWatcherCreator = (): fs.FSWatcher | null => { - try { - return fs.watch( - FLEX_USB_MOUNT_DIR, - { persistent: true }, - (event, fileName) => { - if (!!!fileName) { - rescan(dispatch) + const mediaWatcher = fs.watch( + FLEX_USB_MOUNT_DIR, + { persistent: true }, + (event, fileName) => { + if (!!!fileName) { + rescan(dispatch) + return + } + if (!fileName.match(FLEX_USB_MOUNT_FILTER)) { + return + } + const fullPath = join(FLEX_USB_MOUNT_DIR, fileName) + fsPromises + .stat(fullPath) + .then(info => { + if (!info.isDirectory) { return } - if (!fileName.match(FLEX_USB_MOUNT_FILTER)) { + if (prevDirs.includes(fullPath)) { return } - const fullPath = join(FLEX_USB_MOUNT_DIR, fileName) - fsPromises - .stat(fullPath) - .then(info => { - if (!info.isDirectory) { - return - } - if (prevDirs.includes(fullPath)) { - return - } - console.log(`New mass storage device ${fileName} detected`) - prevDirs.push(fullPath) - return handleNewlyPresent(fullPath) - }) - .catch(() => { - if (prevDirs.includes(fullPath)) { - console.log(`Mass storage device at ${fileName} removed`) - prevDirs = prevDirs.filter(entry => entry !== fullPath) - dispatch(robotMassStorageDeviceRemoved(fullPath)) - } - }) - } - ) - } catch { - return null + console.log(`New mass storage device ${fileName} detected`) + prevDirs.push(fullPath) + return handleNewlyPresent(fullPath) + }) + .catch(() => { + if (prevDirs.includes(fullPath)) { + console.log(`Mass storage device at ${fileName} removed`) + prevDirs = prevDirs.filter(entry => entry !== fullPath) + dispatch(robotMassStorageDeviceRemoved(fullPath)) + } + }) } - } - - const mediaWatcher = mediaWatcherCreator() + ) const devWatcher = fs.watch( FLEX_USB_DEVICE_DIR, @@ -151,7 +142,7 @@ export function watchForMassStorage(dispatch: Dispatch): () => void { ) // we don't care if this fails because it's racing the system removing // the mount dir in the common case - fsPromises.unlink(mountPath).catch(() => { }) + fsPromises.unlink(mountPath).catch(() => {}) } }) } @@ -159,7 +150,7 @@ export function watchForMassStorage(dispatch: Dispatch): () => void { rescan(dispatch) return () => { - mediaWatcher != null && mediaWatcher.close() + mediaWatcher.close() devWatcher.close() } } From 987048845831517b2aa07ef4f0175065e95d6c51 Mon Sep 17 00:00:00 2001 From: Brian Cooper Date: Wed, 1 May 2024 15:20:52 -0400 Subject: [PATCH 4/6] update test stubs --- app/src/organisms/Devices/hooks/useLastRunCommand.ts | 1 - .../RunningProtocol/CurrentRunningProtocolCommand.tsx | 7 ++++--- .../__tests__/CurrentRunningProtocolCommand.test.tsx | 1 + .../__tests__/RunProgressMeter.test.tsx | 7 ++++--- .../RunningProtocol/__tests__/RunningProtocol.test.tsx | 10 +++++----- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/src/organisms/Devices/hooks/useLastRunCommand.ts b/app/src/organisms/Devices/hooks/useLastRunCommand.ts index 3c2616aa4e7..347532abd36 100644 --- a/app/src/organisms/Devices/hooks/useLastRunCommand.ts +++ b/app/src/organisms/Devices/hooks/useLastRunCommand.ts @@ -47,4 +47,3 @@ export function useLastRunCommand( ? commandsData?.data?.[0] ?? null : null } - diff --git a/app/src/organisms/OnDeviceDisplay/RunningProtocol/CurrentRunningProtocolCommand.tsx b/app/src/organisms/OnDeviceDisplay/RunningProtocol/CurrentRunningProtocolCommand.tsx index 5b505890369..eeef83d83ab 100644 --- a/app/src/organisms/OnDeviceDisplay/RunningProtocol/CurrentRunningProtocolCommand.tsx +++ b/app/src/organisms/OnDeviceDisplay/RunningProtocol/CurrentRunningProtocolCommand.tsx @@ -140,9 +140,10 @@ export function CurrentRunningProtocolCommand({ updateLastAnimatedCommand, }: CurrentRunningProtocolCommandProps): JSX.Element | null { const { t } = useTranslation('run_details') - const currentCommand = robotSideAnalysis?.commands.find( - (c: RunTimeCommand, index: number) => index === currentRunCommandIndex - ) ?? lastRunCommand + const currentCommand = + robotSideAnalysis?.commands.find( + (c: RunTimeCommand, index: number) => index === currentRunCommandIndex + ) ?? lastRunCommand let shouldAnimate = true if (currentCommand?.key != null) { diff --git a/app/src/organisms/OnDeviceDisplay/RunningProtocol/__tests__/CurrentRunningProtocolCommand.test.tsx b/app/src/organisms/OnDeviceDisplay/RunningProtocol/__tests__/CurrentRunningProtocolCommand.test.tsx index edb7bc99b10..92b5e7aa274 100644 --- a/app/src/organisms/OnDeviceDisplay/RunningProtocol/__tests__/CurrentRunningProtocolCommand.test.tsx +++ b/app/src/organisms/OnDeviceDisplay/RunningProtocol/__tests__/CurrentRunningProtocolCommand.test.tsx @@ -46,6 +46,7 @@ describe('CurrentRunningProtocolCommand', () => { protocolName: 'mockRunningProtocolName', currentRunCommandIndex: 0, lastAnimatedCommand: null, + lastRunCommand: null, updateLastAnimatedCommand: mockUpdateLastAnimatedCommand, robotType: FLEX_ROBOT_TYPE, } diff --git a/app/src/organisms/RunProgressMeter/__tests__/RunProgressMeter.test.tsx b/app/src/organisms/RunProgressMeter/__tests__/RunProgressMeter.test.tsx index aba56366b27..7a40319e050 100644 --- a/app/src/organisms/RunProgressMeter/__tests__/RunProgressMeter.test.tsx +++ b/app/src/organisms/RunProgressMeter/__tests__/RunProgressMeter.test.tsx @@ -11,6 +11,7 @@ import { RUN_STATUS_IDLE, RUN_STATUS_RUNNING, RUN_STATUS_SUCCEEDED, + RunCommandSummary, } from '@opentrons/api-client' import { i18n } from '../../../i18n' @@ -19,7 +20,7 @@ import { ProgressBar } from '../../../atoms/ProgressBar' import { useRunStatus } from '../../RunTimeControl/hooks' import { useMostRecentCompletedAnalysis } from '../../LabwarePositionCheck/useMostRecentCompletedAnalysis' import { - useNotifyLastRunCommandKey, + useNotifyLastRunCommand, useNotifyRunQuery, } from '../../../resources/runs' import { useDownloadRunLog } from '../../Devices/hooks' @@ -82,9 +83,9 @@ describe('RunProgressMeter', () => { downloadRunLog: vi.fn(), isRunLogLoading: false, }) - when(useNotifyLastRunCommandKey) + when(useNotifyLastRunCommand) .calledWith(NON_DETERMINISTIC_RUN_ID, { refetchInterval: 1000 }) - .thenReturn(NON_DETERMINISTIC_COMMAND_KEY) + .thenReturn({ key: NON_DETERMINISTIC_COMMAND_KEY } as RunCommandSummary) vi.mocked(useNotifyRunQuery).mockReturnValue({ data: null } as any) diff --git a/app/src/pages/RunningProtocol/__tests__/RunningProtocol.test.tsx b/app/src/pages/RunningProtocol/__tests__/RunningProtocol.test.tsx index 2b43991a88f..acf08a15d77 100644 --- a/app/src/pages/RunningProtocol/__tests__/RunningProtocol.test.tsx +++ b/app/src/pages/RunningProtocol/__tests__/RunningProtocol.test.tsx @@ -35,13 +35,13 @@ import { RunPausedSplash } from '../../../organisms/OnDeviceDisplay/RunningProto import { OpenDoorAlertModal } from '../../../organisms/OpenDoorAlertModal' import { RunningProtocol } from '..' import { - useNotifyLastRunCommandKey, + useNotifyLastRunCommand, useNotifyRunQuery, } from '../../../resources/runs' import { useFeatureFlag } from '../../../redux/config' import type { UseQueryResult } from 'react-query' -import type { ProtocolAnalyses } from '@opentrons/api-client' +import type { ProtocolAnalyses, RunCommandSummary } from '@opentrons/api-client' vi.mock('@opentrons/react-api-client') vi.mock('../../../organisms/Devices/hooks') @@ -137,9 +137,9 @@ describe('RunningProtocol', () => { when(vi.mocked(useAllCommandsQuery)) .calledWith(RUN_ID, { cursor: null, pageLength: 1 }) .thenReturn(mockUseAllCommandsResponseNonDeterministic) - vi.mocked(useNotifyLastRunCommandKey).mockReturnValue({ - data: {}, - } as any) + vi.mocked(useNotifyLastRunCommand).mockReturnValue({ + key: 'FAKE_COMMAND_KEY', + } as RunCommandSummary) when(vi.mocked(useFeatureFlag)) .calledWith('enableRunNotes') .thenReturn(true) From 18b9f3dbeeac5c45ed1e0eee885c020549d6ceb3 Mon Sep 17 00:00:00 2001 From: Brian Cooper Date: Wed, 1 May 2024 17:43:00 -0400 Subject: [PATCH 5/6] remove accidental close conflict marker --- app/src/organisms/RunPreview/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/organisms/RunPreview/index.tsx b/app/src/organisms/RunPreview/index.tsx index 05178f0c05f..2c36042a6ca 100644 --- a/app/src/organisms/RunPreview/index.tsx +++ b/app/src/organisms/RunPreview/index.tsx @@ -24,7 +24,6 @@ import { useNotifyLastRunCommand, useNotifyAllCommandsAsPreSerializedList, } from '../../resources/runs' ->>>>>>> edge import { CommandText } from '../CommandText' import { Divider } from '../../atoms/structure' import { NAV_BAR_WIDTH } from '../../App/constants' From a7ca047320a3bec4af811ac2dacd2b339a9d7167 Mon Sep 17 00:00:00 2001 From: Brian Cooper Date: Wed, 1 May 2024 17:55:48 -0400 Subject: [PATCH 6/6] format --- app/src/organisms/RunPreview/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/organisms/RunPreview/index.tsx b/app/src/organisms/RunPreview/index.tsx index 2c36042a6ca..7e2f74238bd 100644 --- a/app/src/organisms/RunPreview/index.tsx +++ b/app/src/organisms/RunPreview/index.tsx @@ -23,7 +23,7 @@ import { useMostRecentCompletedAnalysis } from '../LabwarePositionCheck/useMostR import { useNotifyLastRunCommand, useNotifyAllCommandsAsPreSerializedList, - } from '../../resources/runs' +} from '../../resources/runs' import { CommandText } from '../CommandText' import { Divider } from '../../atoms/structure' import { NAV_BAR_WIDTH } from '../../App/constants'