@@ -1740,9 +1740,15 @@ interface SaveStepFormHelperResult {
17401740function getVacuumConcurrentPauseKind (
17411741 form : FormData | null
17421742) : null | 'profile' | 'stateDuration' {
1743- if ( form == null ) return null
1744- if ( getIsVacuumProfileForm ( form ) ) return 'profile'
1745- if ( getIsVacuumStateWithDurationForm ( form ) ) return 'stateDuration'
1743+ if ( form == null ) {
1744+ return null
1745+ }
1746+ if ( getIsVacuumProfileForm ( form ) ) {
1747+ return 'profile'
1748+ }
1749+ if ( getIsVacuumStateWithDurationForm ( form ) ) {
1750+ return 'stateDuration'
1751+ }
17461752 return null
17471753}
17481754
@@ -1779,24 +1785,24 @@ function saveStepFormHelper(
17791785
17801786 const newThermoPauseForm : PauseFormData | null =
17811787 getThermocyclerFormType ( newForm ) === 'thermocyclerProfile'
1782- ? getThermocyclerProfilePauseForm (
1788+ ? buildThermocyclerProfilePauseForm (
17831789 newForm as ThermocyclerFormData ,
17841790 action . payload . concurrentGroupPauseStepId
17851791 )
17861792 : null
17871793 const newVacVacKind = getVacuumConcurrentPauseKind ( newForm )
1788- const newVacuumPauseForm : PauseFormData | null =
1789- newVacVacKind === 'profile'
1790- ? getVacuumProfilePauseForm (
1791- newForm as VacuumFormData ,
1792- action . payload . concurrentGroupPauseStepId
1793- )
1794- : newVacVacKind === 'stateDuration'
1795- ? getVacuumStateDurationPauseForm (
1796- newForm as VacuumFormData ,
1797- action . payload . concurrentGroupPauseStepId
1798- )
1799- : null
1794+ let newVacuumPauseForm : PauseFormData | null = null
1795+ if ( newVacVacKind === 'profile' ) {
1796+ newVacuumPauseForm = buildVacuumProfilePauseForm (
1797+ newForm as VacuumFormData ,
1798+ action . payload . concurrentGroupPauseStepId
1799+ )
1800+ } else if ( newVacVacKind === 'stateDuration' ) {
1801+ newVacuumPauseForm = buildVacuumStateDurationPauseForm (
1802+ newForm as VacuumFormData ,
1803+ action . payload . concurrentGroupPauseStepId
1804+ )
1805+ }
18001806 const newPauseForms = [ newThermoPauseForm , newVacuumPauseForm ] . filter (
18011807 ( f ) : f is PauseFormData => f != null
18021808 )
@@ -1864,19 +1870,19 @@ function saveStepFormHelper(
18641870 const newVacKind = getVacuumConcurrentPauseKind ( newForm )
18651871 const newPauseForm =
18661872 newVacKind === 'profile'
1867- ? getVacuumProfilePauseForm (
1873+ ? buildVacuumProfilePauseForm (
18681874 newForm as VacuumFormData ,
18691875 action . payload . concurrentGroupPauseStepId
18701876 )
1871- : getVacuumStateDurationPauseForm (
1877+ : buildVacuumStateDurationPauseForm (
18721878 newForm as VacuumFormData ,
18731879 action . payload . concurrentGroupPauseStepId
18741880 )
18751881 const orderWithoutOldPauses = originalOrderedStepIds . filter (
18761882 id => id === newForm . id || ! pairedToRemove . has ( id )
18771883 )
1878- const vacIdx = orderWithoutOldPauses . indexOf ( newForm . id )
1879- if ( vacIdx === - 1 ) {
1884+ const vacuumStepIndex = orderWithoutOldPauses . indexOf ( newForm . id )
1885+ if ( vacuumStepIndex === - 1 ) {
18801886 console . error (
18811887 'Error rearranging steps for a vacuum concurrent pairing change. Leaving the steps unchanged.'
18821888 )
@@ -1886,9 +1892,9 @@ function saveStepFormHelper(
18861892 }
18871893 }
18881894 const newOrderedStepIds = [
1889- ...orderWithoutOldPauses . slice ( 0 , vacIdx + 1 ) ,
1895+ ...orderWithoutOldPauses . slice ( 0 , vacuumStepIndex + 1 ) ,
18901896 newPauseForm . id ,
1891- ...orderWithoutOldPauses . slice ( vacIdx + 1 ) ,
1897+ ...orderWithoutOldPauses . slice ( vacuumStepIndex + 1 ) ,
18921898 ]
18931899 return {
18941900 newOrderedStepIds,
@@ -1905,11 +1911,11 @@ function saveStepFormHelper(
19051911 const newVacKind = getVacuumConcurrentPauseKind ( newForm )
19061912 const newPauseForm =
19071913 newVacKind === 'profile'
1908- ? getVacuumProfilePauseForm (
1914+ ? buildVacuumProfilePauseForm (
19091915 newForm as VacuumFormData ,
19101916 action . payload . concurrentGroupPauseStepId
19111917 )
1912- : getVacuumStateDurationPauseForm (
1918+ : buildVacuumStateDurationPauseForm (
19131919 newForm as VacuumFormData ,
19141920 action . payload . concurrentGroupPauseStepId
19151921 )
@@ -1947,7 +1953,7 @@ function saveStepFormHelper(
19471953 // 1) Potentially find a new position to move it to, since we can't allow Thermocycler profiles to nest.
19481954 // 2) Create a hidden "wait for profile to complete" step that it will be permanently paired with.
19491955
1950- const newPauseForm = getThermocyclerProfilePauseForm (
1956+ const newPauseForm = buildThermocyclerProfilePauseForm (
19511957 newForm as ThermocyclerFormData ,
19521958 action . payload . concurrentGroupPauseStepId
19531959 )
@@ -2001,7 +2007,7 @@ function saveStepFormHelper(
20012007 }
20022008}
20032009
2004- function getThermocyclerProfilePauseForm (
2010+ function buildThermocyclerProfilePauseForm (
20052011 thermocyclerForm : ThermocyclerFormData ,
20062012 id : string
20072013) : PauseFormData {
@@ -2016,7 +2022,7 @@ function getThermocyclerProfilePauseForm(
20162022 }
20172023}
20182024
2019- function getVacuumProfilePauseForm (
2025+ function buildVacuumProfilePauseForm (
20202026 vacuumForm : VacuumFormData ,
20212027 id : string
20222028) : PauseFormData {
@@ -2031,7 +2037,7 @@ function getVacuumProfilePauseForm(
20312037 }
20322038}
20332039
2034- function getVacuumStateDurationPauseForm (
2040+ function buildVacuumStateDurationPauseForm (
20352041 vacuumForm : VacuumFormData ,
20362042 id : string
20372043) : PauseFormData {
0 commit comments