Skip to content

Commit

Permalink
fix(app): clear intervention modal if run is finishing
Browse files Browse the repository at this point in the history
Remove InterventionModal if run is finishing. Implement useNotifyLastRunCommand in desktop
RunProgressMeter

Closes RQA-2730
  • Loading branch information
ncdiehl11 committed May 16, 2024
1 parent 97da85c commit a2909e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions app/src/organisms/RunProgressMeter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ import { ProgressBar } from '../../atoms/ProgressBar'
import { useDownloadRunLog, useRobotType } from '../Devices/hooks'
import { InterventionTicks } from './InterventionTicks'
import { isInterventionCommand } from '../InterventionModal/utils'
import { useNotifyRunQuery } from '../../resources/runs'
import {
useNotifyLastRunCommand,
useNotifyRunQuery,
} from '../../resources/runs'

import type { RunStatus } from '@opentrons/api-client'

Expand Down Expand Up @@ -79,7 +82,7 @@ export function RunProgressMeter(props: RunProgressMeterProps): JSX.Element {
pageLength: 1,
})
const analysisCommands = analysis?.commands ?? []
const lastRunCommand = allCommandsQueryData?.data[0] ?? null
const lastRunCommand = useNotifyLastRunCommand(runId)
const runCommandsLength = allCommandsQueryData?.meta.totalLength

const downloadIsDisabled =
Expand Down
4 changes: 3 additions & 1 deletion app/src/pages/RunningProtocol/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
RUN_STATUS_STOP_REQUESTED,
RUN_STATUS_BLOCKED_BY_OPEN_DOOR,
RUN_STATUS_AWAITING_RECOVERY,
RUN_STATUS_FINISHING,
} from '@opentrons/api-client'

import { useFeatureFlag } from '../../redux/config'
Expand Down Expand Up @@ -203,7 +204,8 @@ export function RunningProtocol(): JSX.Element {
{interventionModalCommandKey != null &&
runRecord?.data != null &&
lastRunCommand != null &&
isInterventionCommand(lastRunCommand) ? (
isInterventionCommand(lastRunCommand) &&
runStatus !== RUN_STATUS_FINISHING ? (
<InterventionModal
robotName={robotName}
command={lastRunCommand}
Expand Down

0 comments on commit a2909e3

Please sign in to comment.