Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stopSubmit or setSubmitFailed should delete submitPromise #2591

Closed
ghola opened this issue Feb 14, 2017 · 2 comments
Closed

stopSubmit or setSubmitFailed should delete submitPromise #2591

ghola opened this issue Feb 14, 2017 · 2 comments
Labels

Comments

@ghola
Copy link

ghola commented Feb 14, 2017

bug report

When using with redux-saga a good trick is to return an empty Promise from the onSubmit function, like so:

const mapDispatchToProps = (dispatch) => {
    return {
        onSubmit: (value) => {
            dispatch({type: 'LOGIN_WITH_EMAIL', payload: {email: value.email, password: value.password}});

            return new Promise(() => { }); // sets form state to SUBMITTING
        }
    }
}

Then in the saga, if the api call on the server fails, one would simply dispatch stopSubmit('LoginForm', { _error: error}).

All of this works for one submit. Subsequent attempts to submit are ignored because the submit promise returned by onSubmit remains undeleted (https://github.com/erikras/redux-form/blob/master/src/reduxForm.js#L407). Since the submit has stopped, shouldn't the submitPromise be cleared too?

This happens in any redux-form 6.* version.

@erikras
Copy link
Member

erikras commented Mar 29, 2017

Fix published in v6.6.1.

@lock
Copy link

lock bot commented Jun 1, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants