@@ -21,8 +21,8 @@ import { ClientError } from 'graphql-request';
21
21
import { DestinationSelectionMode } from '../../../components/slotMapper/slotMapper.types' ;
22
22
import { Draft } from 'immer' ;
23
23
import { flaggedLabwareLayout } from '../../factories/labwareFactory' ;
24
- import { initialOutputLabware } from '../../../pages/CytAssist' ;
25
24
import { eventBus } from '../../../eventBus' ;
25
+ import { initialOutputLabware } from '../../../pages/CytAssist' ;
26
26
27
27
/**
28
28
* Context for SlotCopy Machine
@@ -636,7 +636,12 @@ export const slotCopyMachine = createMachine(
636
636
...context ,
637
637
serverErrors : null ,
638
638
sources : [ ] ,
639
- destinations : [ initialOutputLabware ]
639
+ destinations : [
640
+ {
641
+ labware : initialOutputLabware . labware ,
642
+ slotCopyDetails : { lpNumber : context . destinations [ 0 ] . slotCopyDetails . lpNumber , contents : [ ] }
643
+ }
644
+ ]
640
645
} ;
641
646
}
642
647
return context ;
@@ -767,21 +772,24 @@ export const slotCopyMachine = createMachine(
767
772
assignDraftedCytAssist : assign ( ( { context, event } ) => {
768
773
if ( event . type !== 'xstate.done.actor.reloadDraftedCytAssist' ) return context ;
769
774
return produce ( context , ( draft ) => {
770
- const layout = flaggedLabwareLayout ( event . output . reloadSlotCopy ! . labwareType ! ) ;
771
- if ( ! layout ) return draft ;
772
775
if ( event . output . reloadSlotCopy ) {
776
+ const draftedLayout = flaggedLabwareLayout ( event . output . reloadSlotCopy ! . labwareType ! ) ;
773
777
const { sources, operationType, workNumber, executionType, lpNumber, ...copyDetails } =
774
778
event . output . reloadSlotCopy ;
775
779
draft . destinations [ 0 ] = {
776
- labware : layout ,
780
+ labware : draftedLayout || initialOutputLabware . labware ,
777
781
slotCopyDetails : {
778
782
...draft . destinations [ 0 ] . slotCopyDetails ,
779
783
...copyDetails
780
784
}
781
785
} ;
782
- draft . sources = event . output . inputLabware ?. map ( ( labware ) => {
783
- return { labware, cleanedOutAddresses : event . output . cleanedOutInputAddresses . get ( labware . id ) ?? [ ] } ;
784
- } ) ;
786
+ if ( event . output . inputLabware ) {
787
+ draft . sources = event . output . inputLabware . map ( ( labware ) => {
788
+ return { labware, cleanedOutAddresses : event . output . cleanedOutInputAddresses . get ( labware . id ) ?? [ ] } ;
789
+ } ) ;
790
+ } else {
791
+ draft . sources = [ ] ;
792
+ }
785
793
}
786
794
} ) ;
787
795
} ) ,
0 commit comments