Skip to content

Commit f619b23

Browse files
committed
fix(protocol-designer): fix temperature step form
This PR fixes a bug in the temperature step form where a form error is incorrecly returned if a user has not entered a temperature, even if the setTemperature ield is set to false. The error arose from incorrectly parsing the string literals for 'true' / 'false'. Also, this PR fixes the step summary text for deactivating a temperature module Closes RQA-3947, RQA-3948
1 parent 78848e5 commit f619b23

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

protocol-designer/src/pages/Designer/ProtocolSteps/StepSummary.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,18 +267,19 @@ export function StepSummary(props: StepSummaryProps): JSX.Element | null {
267267
setTemperature,
268268
targetTemperature,
269269
} = currentStep
270-
const isDeactivating = setTemperature === 'false'
270+
const isSettingTemperature =
271+
setTemperature != null && JSON.parse(String(setTemperature ?? false))
271272
const tempModuleDisplayName =
272273
getModuleDisplayName(modules[tempModuleId]?.model) ?? unknownModule
273-
stepSummaryContent = isDeactivating ? (
274+
stepSummaryContent = isSettingTemperature ? (
274275
<StyledTrans
275-
i18nKey={'protocol_steps:temperature_module.deactivated'}
276+
i18nKey={'protocol_steps:temperature_module.active'}
277+
tagText={`${targetTemperature}${t('application:units.degrees')}`}
276278
values={{ module: tempModuleDisplayName }}
277279
/>
278280
) : (
279281
<StyledTrans
280-
i18nKey={'protocol_steps:temperature_module.active'}
281-
tagText={`${targetTemperature}${t('application:units.degrees')}`}
282+
i18nKey={'protocol_steps:temperature_module.deactivated'}
282283
values={{ module: tempModuleDisplayName }}
283284
/>
284285
)

protocol-designer/src/steplist/formLevel/errors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ export const targetTemperatureRequired = (
559559
fields: HydratedFormData
560560
): FormError | null => {
561561
const { setTemperature, targetTemperature } = fields
562-
return setTemperature && !targetTemperature
562+
return JSON.parse(String(setTemperature ?? false)) && !targetTemperature
563563
? TARGET_TEMPERATURE_REQUIRED
564564
: null
565565
}

0 commit comments

Comments
 (0)