I have been using a redux-observable
epic to upload images to my AWS S3 bucket through react-native-aws3
. It has been functioning smoothly for quite some time. However, recently it seems to have stopped entering the .map
and .catch
blocks of code. I suspect that it may not even be initiating a network request anymore. What could possibly be causing this unexpected behavior?
Here is the code snippet:
//@flow
import { RNS3 } from 'react-native-aws3'
import 'redux-observable'
import { Observable } from 'rxjs'
// $FlowFixMe
import 'rxjs/add/operator/catch'
// $FlowFixMe
import { ajax } from 'rxjs/observable/dom/ajax'
import type { VepoState } from 'src/components/model'
import type { RecordOf } from 'immutable'
import {
updateAlertModalIsOpen,
updateAlertModalMessage,
updateAlertModalTitle
} from 'src/components/formControls/alertModal/action'
import Toast from 'react-native-root-toast'
import 'redux-observable'
import { s3options } from 'src/components/model'
import type { Epic, ActionsObservable } from 'redux-observable'
import type { RequestFulfilledDto, RequestRejectedDto } from 'src/model/ajax'
import {
uploadAddProductImageFulfilled,
uploadAddProductImageRejected,
updateAddProductImageInDb,
updateAddProductImageInDbFulfilled,
updateAddProductImageInDbRejected,
UPLOAD_ADD_PRODUCT_IMAGE,
UPLOAD_ADD_PRODUCT_IMAGE_FULFILLED,
UPLOAD_ADD_PRODUCT_IMAGE_REJECTED,
UPDATE_ADD_PRODUCT_IMAGE_IN_DB,
UPDATE_ADD_PRODUCT_IMAGE_IN_DB_FULFILLED,
UPDATE_ADD_PRODUCT_IMAGE_IN_DB_REJECTED,
UPLOAD_ADD_PRODUCT,
UPLOAD_ADD_PRODUCT_FULFILLED,
UPLOAD_ADD_PRODUCT_REJECTED,
uploadAddProductFulfilled,
uploadAddProductRejected,
updateAddProductId
} from './action'
import { deselectAllCategories } from 'src/components/formControls/categoriesMultiselect/action'
import {
updateLocationAutocompleteSearchText,
updateShouldHideLocationResults,
updateLocationAutocompletePlace,
updateLocationListDisplayed
} from 'src/components/formControls/locationAutocomplete/redux'
import { updateProductImageLink } from 'src/components/formControls/imagePicker/redux'
import { uploadAddProductImage } from 'src/components/product/add/groceryItem/action'
export const uploadAddProductImageEpic = (action$: ActionsObservable<string>) =>
action$.ofType(UPLOAD_ADD_PRODUCT_IMAGE).mergeMap((action) => {
return Observable.fromPromise(RNS3.put(action.payload, action.config))
.map((response) => {
return uploadAddProductImageFulfilled(response)
})
.catch((error) => {
return Observable.of(uploadAddProductImageRejected(error))
})
})