import { of } from 'rxjs' ; import { filter , withLatestFrom , mergeMap } from 'rxjs/operators' ; import { ofType } from 'redux-observable' ; import { getConnectedRobotName } from '../../../robot/selectors' ; import * as Actions from '../actions' ; import type { Epic } from '../../../types' ; export const fetchPipetteOffsetCalibrationsOnConnectEpic = ( action$ , state$ ) => { return action$ . pipe ( ofType ( 'robot:CONNECT_RESPONSE' ) , withLatestFrom ( state$ , ( a , s ) => [ a , getConnectedRobotName ( s ) ] ) , filter ( ( [ action , robotName ] ) => robotName != null ) , mergeMap ( robotName => { return of ( Actions . fetchPipetteOffsetCalibrations ( robotName ) ) ; } ) ) ; } ;