Skip to content

Commit a84f58a

Browse files
authored
fix(app): disable exit button after successful pipette attach/detach (#15205)
Closes RQA-2731 On OT-2, after a pipette is attached or detached successfully, the exit button should only be clickable once, so that many home commands are not emitted in rapid succession with each click.
1 parent 737865d commit a84f58a

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

app/src/organisms/ChangePipette/ConfirmPipette.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export function ConfirmPipette(props: ConfirmPipetteProps): JSX.Element {
5858
actualPipette,
5959
setConfirmPipetteLevel,
6060
confirmPipetteLevel,
61+
isDisabled,
6162
} = props
6263
const { t } = useTranslation('change_pipette')
6364

@@ -141,6 +142,7 @@ export function ConfirmPipette(props: ConfirmPipetteProps): JSX.Element {
141142
<SuccessAndExitButtons
142143
{...props}
143144
confirmPipetteLevel={confirmPipetteLevel}
145+
isDisabled={isDisabled}
144146
/>
145147
) : null}
146148
</>
@@ -221,6 +223,7 @@ function SuccessAndExitButtons(props: ConfirmPipetteProps): JSX.Element {
221223
toCalibrationDashboard,
222224
success,
223225
wrongWantedPipette,
226+
isDisabled,
224227
} = props
225228
const { t } = useTranslation('change_pipette')
226229
return (
@@ -230,11 +233,16 @@ function SuccessAndExitButtons(props: ConfirmPipetteProps): JSX.Element {
230233
<SecondaryButton
231234
marginRight={SPACING.spacing8}
232235
onClick={toCalibrationDashboard}
236+
disabled={isDisabled}
233237
>
234238
{t('calibrate_pipette_offset')}
235239
</SecondaryButton>
236240
) : null}
237-
<PrimaryButton textTransform={TEXT_TRANSFORM_CAPITALIZE} onClick={exit}>
241+
<PrimaryButton
242+
textTransform={TEXT_TRANSFORM_CAPITALIZE}
243+
onClick={exit}
244+
disabled={isDisabled}
245+
>
238246
{t('shared:exit')}
239247
</PrimaryButton>
240248
</>

app/src/organisms/ChangePipette/__tests__/ConfirmPipette.test.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,19 @@ describe('ConfirmPipette', () => {
427427
fireEvent.click(pocBtn)
428428
expect(props.toCalibrationDashboard).toBeCalled()
429429
})
430-
it('should render buttons as disabled when robot is in motion/isDisabled is true', () => {
430+
it('should render buttons as disabled on success when robot is in motion/isDisabled is true', () => {
431+
props = {
432+
...props,
433+
success: true,
434+
isDisabled: true,
435+
}
436+
const { getByRole } = render(props)
437+
expect(getByRole('button', { name: 'exit' })).toBeDisabled()
438+
expect(
439+
getByRole('button', { name: 'Calibrate pipette offset' })
440+
).toBeDisabled()
441+
})
442+
it('should render buttons as disabled on failure when robot is in motion/isDisabled is true', () => {
431443
props = {
432444
...props,
433445
success: false,

0 commit comments

Comments
 (0)