Skip to content

Commit

Permalink
refactor(app): ensure drop tip post run CTA doesn't display while rel…
Browse files Browse the repository at this point in the history
…oading run
  • Loading branch information
mjhuff committed Nov 19, 2024
1 parent 412e29f commit 0cdec49
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export function useActionButtonProperties({
handleButtonClick = () => {
isResetRunLoadingRef.current = true
reset()
runHeaderModalContainerUtils.dropTipUtils.resetTipStatus()
trackEvent({
name: ANALYTICS_PROTOCOL_PROCEED_TO_RUN,
properties: { sourceLocation: 'RunRecordDetail', robotSerialNumber },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import type { Run, RunStatus } from '@opentrons/api-client'
import type {
DropTipWizardFlowsProps,
PipetteWithTip,
TipAttachmentStatusResult,
} from '/app/organisms/DropTipWizardFlows'
import type { UseProtocolDropTipModalResult } from '../modals'
import type { PipetteDetails } from '/app/resources/maintenance_runs'
Expand All @@ -40,6 +41,7 @@ export interface UseRunHeaderDropTipParams {
export interface UseRunHeaderDropTipResult {
dropTipModalUtils: UseProtocolDropTipModalResult
dropTipWizardUtils: RunHeaderDropTipWizProps
resetTipStatus: TipAttachmentStatusResult['resetTipStatus']
}

// Handles all the tip related logic during a protocol run on the desktop app.
Expand Down Expand Up @@ -111,11 +113,9 @@ export function useRunHeaderDropTip({
{
includeFixitCommands: false,
pageLength: 1,
cursor: null,
},
{ enabled: isTerminalRunStatus(runStatus) }
)

// Manage tip checking
useEffect(() => {
// If a user begins a new run without navigating away from the run page, reset tip status.
Expand All @@ -127,7 +127,9 @@ export function useRunHeaderDropTip({
// have to do it here if done during Error Recovery.
else if (
runSummaryNoFixit != null &&
!lastRunCommandPromptedErrorRecovery(runSummaryNoFixit)
runSummaryNoFixit.length > 0 &&
!lastRunCommandPromptedErrorRecovery(runSummaryNoFixit) &&
isTerminalRunStatus(runStatus)
) {
void determineTipStatus()
}
Expand All @@ -150,7 +152,11 @@ export function useRunHeaderDropTip({
}
}, [runStatus, isRunCurrent, enteredER, initialPipettesWithTipsCount])

return { dropTipModalUtils, dropTipWizardUtils: buildDTWizUtils() }
return {
dropTipModalUtils,
dropTipWizardUtils: buildDTWizUtils(),
resetTipStatus,
}
}

// TODO(jh, 09-12-24): Consolidate this with the same utility that exists elsewhere.
Expand Down
3 changes: 1 addition & 2 deletions app/src/pages/ODD/RunSummary/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,15 +243,14 @@ export function RunSummary(): JSX.Element {
const runSummaryNoFixit = useCurrentRunCommands({
includeFixitCommands: false,
pageLength: 1,
cursor: null,
})
useEffect(() => {
if (
isRunCurrent &&
runSummaryNoFixit != null &&
runSummaryNoFixit.length > 0 &&
!lastRunCommandPromptedErrorRecovery(runSummaryNoFixit)
) {
console.log('HITTING THIS')
void determineTipStatus()
}
}, [runSummaryNoFixit, isRunCurrent])
Expand Down

0 comments on commit 0cdec49

Please sign in to comment.