Skip to content

Commit

Permalink
fix(protocol-designer): fixes thermocycler content type (#16675)
Browse files Browse the repository at this point in the history
fix RQA-3430

<!--
Thanks for taking the time to open a Pull Request (PR)! Please make sure
you've read the "Opening Pull Requests" section of our Contributing
Guide:


https://github.com/Opentrons/opentrons/blob/edge/CONTRIBUTING.md#opening-pull-requests

GitHub provides robust markdown to format your PR. Links, diagrams,
pictures, and videos along with text formatting make it possible to
create a rich and informative PR. For more information on GitHub
markdown, see:


https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax

To ensure your code is reviewed quickly and thoroughly, please fill out
the sections below to the best of your ability!
-->

# Overview

<!--
Describe your PR at a high level. State acceptance criteria and how this
PR fits into other work. Link issues, PRs, and other relevant resources.
-->

I noticed that the `RadioButton` component’s `onChange` prop was
preventing `propsForFields.thermocyclerFormType` from updating from
'null' to 'thermocyclerState' when `contentType` was initially set to
'thermocyclerState' already. To address this, I updated the default
`thermocyclerFormType` to 'thermocyclerState' and make step 1 as the
default page when edit instead of step 2.

## Test Plan and Hands on Testing

<!--
Describe your testing of the PR. Emphasize testing not reflected in the
code. Attach protocols, logs, screenshots and any other assets that
support your testing.
-->

## Changelog

<!--
List changes introduced by this PR considering future developers and the
end user. Give careful thought and clear documentation to breaking
changes.
-->

## Review requests

<!--
- What do you need from reviewers to feel confident this PR is ready to
merge?
- Ask questions.
-->

## Risk assessment

<!--
- Indicate the level of attention this PR needs.
- Provide context to guide reviewers.
- Discuss trade-offs, coupling, and side effects.
- Look for the possibility, even if you think it's small, that your
change may affect some other part of the system.
- For instance, changing return tip behavior may also change the
behavior of labware calibration.
- How do your unit tests and on hands on testing mitigate this PR's
risks and the risk of future regressions?
- Especially in high risk PRs, explain how you know your testing is
enough.
-->

---------

Co-authored-by: shiyaochen <[email protected]>
  • Loading branch information
syao1226 and shiyaochen authored Nov 5, 2024
1 parent 3200655 commit 2a1470f
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,7 @@ export function StepFormToolbox(props: StepFormToolboxProps): JSX.Element {
getFormLevelErrorsForUnsavedForm
)
const timeline = useSelector(getRobotStateTimeline)
const [toolboxStep, setToolboxStep] = useState<number>(
// progress to step 2 if thermocycler form is populated
formData.thermocyclerFormType === 'thermocyclerProfile' ||
formData.thermocyclerFormType === 'thermocyclerState'
? 1
: 0
)
const [toolboxStep, setToolboxStep] = useState<number>(0)
const [
showFormErrorsAndWarnings,
setShowFormErrorsAndWarnings,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ export function ThermocyclerTools(props: StepFormProps): JSX.Element {
const { t } = useTranslation('form')

const [contentType, setContentType] = useState<ThermocyclerContentType>(
(formData.thermocyclerFormType as ThermocyclerContentType) ??
'thermocyclerState'
formData.thermocyclerFormType as ThermocyclerContentType
)

if (toolboxStep === 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ describe('createPresavedStepForm', () => {
stepDetails: '',
stepName: 'thermocycler',
stepType: 'thermocycler',
thermocyclerFormType: null,
thermocyclerFormType: 'thermocyclerState',
})
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export function getDefaultsForStepType(
profileItemsById: {},
profileTargetLidTemp: null,
profileVolume: null,
thermocyclerFormType: null,
thermocyclerFormType: 'thermocyclerState',
}

default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ describe('getDefaultsForStepType', () => {
describe('thermocycler step', () => {
it('should get the correct defaults', () => {
expect(getDefaultsForStepType('thermocycler')).toEqual({
thermocyclerFormType: null,
thermocyclerFormType: 'thermocyclerState',
moduleId: null,
blockIsActive: false,
blockTargetTemp: null,
Expand Down

0 comments on commit 2a1470f

Please sign in to comment.