Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(app): invalidate OT2 calibration queries when calibration flows complete #13809

Merged
merged 2 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions app/src/organisms/CalibrateDeck/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Deck Calibration Orchestration Component
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import { useQueryClient } from 'react-query'

import { useHost } from '@opentrons/react-api-client'
import { getPipetteModelSpecs } from '@opentrons/shared-data'
import { useConditionalConfirm } from '@opentrons/components'

Expand Down Expand Up @@ -71,6 +73,9 @@ export function CalibrateDeck(
const { currentStep, instrument, labware, supportedCommands } =
session?.details || {}

const queryClient = useQueryClient()
const host = useHost()

const {
showConfirmation: showConfirmExit,
confirm: confirmExit,
Expand All @@ -97,6 +102,11 @@ export function CalibrateDeck(
}

function cleanUpAndExit(): void {
queryClient
.invalidateQueries([host, 'calibration'])
.catch((e: Error) =>
console.error(`error invalidating calibration queries: ${e.message}`)
)
if (
exitBeforeDeckConfigCompletion &&
currentStep !== Sessions.DECK_STEP_CALIBRATION_COMPLETE
Expand Down
10 changes: 10 additions & 0 deletions app/src/organisms/CalibratePipetteOffset/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Pipette Offset Calibration Orchestration Component
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import { useQueryClient } from 'react-query'

import { useHost } from '@opentrons/react-api-client'
import { getPipetteModelSpecs } from '@opentrons/shared-data'
import { useConditionalConfirm } from '@opentrons/components'

Expand Down Expand Up @@ -60,6 +62,9 @@ export function CalibratePipetteOffset(
const { currentStep, instrument, labware, supportedCommands } =
session?.details ?? {}

const queryClient = useQueryClient()
const host = useHost()

const {
showConfirmation: showConfirmExit,
confirm: confirmExit,
Expand Down Expand Up @@ -92,6 +97,11 @@ export function CalibratePipetteOffset(
}

function cleanUpAndExit(): void {
queryClient
.invalidateQueries([host, 'calibration'])
.catch((e: Error) =>
console.error(`error invalidating calibration queries: ${e.message}`)
)
if (session?.id != null) {
dispatchRequests(
Sessions.createSessionCommand(robotName, session.id, {
Expand Down
10 changes: 10 additions & 0 deletions app/src/organisms/CalibrateTipLength/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Tip Length Calibration Orchestration Component
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import { useQueryClient } from 'react-query'
import { css } from 'styled-components'

import { useHost } from '@opentrons/react-api-client'
import { getPipetteModelSpecs } from '@opentrons/shared-data'
import { useConditionalConfirm } from '@opentrons/components'

Expand Down Expand Up @@ -72,6 +74,9 @@ export function CalibrateTipLength(
} = props
const { currentStep, instrument, labware } = session?.details ?? {}

const queryClient = useQueryClient()
const host = useHost()

const isMulti = React.useMemo(() => {
const spec =
instrument != null ? getPipetteModelSpecs(instrument.model) : null
Expand All @@ -96,6 +101,11 @@ export function CalibrateTipLength(
}

function cleanUpAndExit(): void {
queryClient
.invalidateQueries([host, 'calibration'])
.catch((e: Error) =>
console.error(`error invalidating calibration queries: ${e.message}`)
)
if (session?.id != null) {
dispatchRequests(
Sessions.createSessionCommand(robotName, session.id, {
Expand Down