Skip to content

Commit

Permalink
fix(app): do not gate /runCommandErrors on the run being current
Browse files Browse the repository at this point in the history
  • Loading branch information
mjhuff committed Jan 9, 2025
1 parent 9b10793 commit 2dc62af
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,10 @@ function ProtocolRunErrorBanner({

const { closeCurrentRun } = useCloseCurrentRun()

const { highestPriorityError, commandErrorList } = runErrors
const { highestPriorityError } = runErrors

const handleFailedRunClick = (): void => {
// TODO(jh, 08-15-24): Revisit the control flow here here after
// commandErrorList may be fetched for a non-current run.
if (commandErrorList == null) {
closeCurrentRun()
}
closeCurrentRun()
runHeaderModalContainerUtils.runFailedModalUtils.toggleModal()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,13 @@ export function useRunHeaderDropTip({
}
}, [runStatus, robotType, isRunCurrent])

// TODO(jh, 08-15-24): The enteredER condition is a hack, because errorCommands are only returned when a run is current.
// Ideally the run should not need to be current to view errorCommands.

// If the run terminates with a "stopped" status, close the run if no tips are attached after running tip check at least once.
// This marks the robot as "not busy" if drop tip CTAs are unnecessary.
useEffect(() => {
if (
runStatus === RUN_STATUS_STOPPED &&
isRunCurrent &&
(initialPipettesWithTipsCount === 0 || robotType === OT2_ROBOT_TYPE) &&
!enteredER
(initialPipettesWithTipsCount === 0 || robotType === OT2_ROBOT_TYPE)
) {
closeCurrentRun()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useRunCommandErrors } from '@opentrons/react-api-client'

import { isTerminalRunStatus } from '../utils'
import { useMostRecentRunId } from '/app/resources/runs'
import { getHighestPriorityError } from '/app/transformations/runs'

import type { RunStatus, Run } from '@opentrons/api-client'
Expand All @@ -27,14 +26,11 @@ export function useRunErrors({
runRecord,
runStatus,
}: UseRunErrorsProps): UseRunErrorsResult {
const mostRecentRunId = useMostRecentRunId()
const isMostRecentRun = mostRecentRunId === runId

const { data: commandErrorList } = useRunCommandErrors(
runId,
{ cursor: 0, pageLength: ALL_COMMANDS_PAGE_LENGTH },
{
enabled: isTerminalRunStatus(runStatus) && isMostRecentRun,
enabled: isTerminalRunStatus(runStatus),
}
)

Expand Down

0 comments on commit 2dc62af

Please sign in to comment.