colinbate / redux-form-submit-saga

Handles redux-form submissions using redux-saga
MIT License
61 stars 12 forks source link

Timing issue #1

Closed marcselman closed 8 years ago

marcselman commented 8 years ago

Hi, First of all, I've tried your module and the redux-form-saga module and yours works a lot better!

I've noticed that when my saga handles the SUBMIT request too fast and returns a SUCCESS, the SUCCESS action is dispatched before the "redux-form/START_SUBMIT" action and the submit never finishes. You can replicate this by having a saga directly dispatch the SUCCESS action. I've solved this by first waiting for the "redux-form/START_SUBMIT" action in my saga before continuing.

export function* saveUserDataSaga(action) {
    // I've added the line below to solve my timing issue
    yield take('redux-form/START_SUBMIT')
    yield put({
        type: SAVE_USER_DATA_SUCCESS,
        payload: action.payload
    })
}

Is this a bug that could be fixed in your module or did I miss something?

Thanks!

colinbate commented 8 years ago

I'd noticed this type of thing happening in the application I wrote this for in just the situation you mentioned.

I took a look at it briefly and it didn't appear to be so straightforward but rather dependent on the underlying saga behaviour. If I recall I could fix it with an async delay but that felt awkward. Now that I know this is affecting others I'll take another look at it.

colinbate commented 8 years ago

Version 1.0.2 should fix is this. Reopen if not.

marcselman commented 8 years ago

Thanks for the quick fix!