Skip to content

Commit

Permalink
refactor(protocol-designer): remove unneeded loadLabware commands fro…
Browse files Browse the repository at this point in the history
…m 8_0_0 migration (#13945)
  • Loading branch information
jerader committed Nov 8, 2023
1 parent 1ecdd33 commit 259dd3e
Showing 1 changed file with 2 additions and 37 deletions.
39 changes: 2 additions & 37 deletions protocol-designer/src/load-file/migration/8_0_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,7 @@ interface LabwareLocationUpdate {
export const migrateFile = (
appData: ProtocolFileV7<DesignerApplicationData>
): ProtocolFile => {
const {
designerApplication,
commands,
robot,
labwareDefinitions,
liquids,
} = appData
const { designerApplication, commands, robot, liquids } = appData

if (designerApplication == null || designerApplication.data == null) {
throw Error('The designerApplication key in your file is corrupt.')
Expand Down Expand Up @@ -135,31 +129,6 @@ export const migrateFile = (
filteredSavedStepForms
)

const loadLabwareCommands: LoadLabwareCreateCommand[] = commands
.filter(
(command): command is LoadLabwareCreateCommand =>
command.commandType === 'loadLabware'
)
.map(command => {
// protocols that do multiple migrations through 7.0.0 have a loadName === definitionURI
// this ternary below fixes that
const loadName =
labwareDefinitions[command.params.loadName] != null
? labwareDefinitions[command.params.loadName].parameters.loadName
: command.params.loadName
return {
...command,
params: {
...command.params,
loadName,
},
}
})

const migratedCommandsV8 = commands.filter(
command => command.commandType !== 'loadLabware'
)

const flexDeckSpec: OT3RobotMixin = {
robot: {
model: FLEX_ROBOT_TYPE,
Expand Down Expand Up @@ -216,11 +185,7 @@ export const migrateFile = (

const commandv8Mixin: CommandV8Mixin = {
commandSchemaId: 'opentronsCommandSchemaV8',
commands: [
...migratedCommandsV8,
...loadLabwareCommands,
...trashLoadCommand,
],
commands: [...commands, ...trashLoadCommand],
}

const commandAnnotionaV1Mixin: CommandAnnotationV1Mixin = {
Expand Down

0 comments on commit 259dd3e

Please sign in to comment.