-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
v6: Using bluebird in asyncValidate causes warning #1153
Comments
That would be a rather devious way to get around Point is, that as a library, Promises that are created should always be handled, or they should be able to be handled by user code (like handleSubmit does when returnRejectedSubmitPromise is set to true). Redux-form should not rely on any Promise library's behaviour. Line 46 in createFieldProps lacks handling the promise returned by it's internal asyncValidate function. The particular rejection from the onBlur point of view is strange, the asyncValidation returned a non-empty error, it's adhering to the api, but along the way, a rejected promise was created (https://github.com/erikras/redux-form/blob/v6/src/asyncValidation.js#L12) |
@q42jaap I also had this problem and tracked it to https://github.com/erikras/redux-form/blob/v6/src/asyncValidation.js#L12 which is bubbling up to https://github.com/erikras/redux-form/blob/v6/src/asyncValidation.js#L20 If you add, for instance, |
Its my opinion that its ok to expose promises that could be rejected for the client to handle them. |
I ran into this problem and I agree with you @eloytoro except that I encountered a specific problem that is unsolvable the way things are implemented currently: Use case
You can test this with the examples (I'm using Chrome 54, also tried Firefox). http://redux-form.com/6.2.0/examples/asyncValidation/
You might say, well, in this case it's not a big problem because it's very specific. But it looks quite differently if you have only one form field. EDIT: I have identified this line to be the cause of all trouble: https://github.com/erikras/redux-form/blob/master/src/handleSubmit.js#L82 (it won't even work when setting a |
@chmanie I followed your reproduction steps successfully on older versions to produce an uncaught promise exception (thank you for these!), but unsuccessfully on 7.0.3 🎉. Would those in this thread be willing to confirm / provide further investigation if needed to clarify the status of this issue? |
You could reproduce it with the async validation example; I tried with http://redux-form.com/7.0.3/examples/asyncValidation/ and it did not occur. I'm willing to say that it's resolved now. |
Cool, thanks! |
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. |
When using a bluebird promise in asyncValidate, invalidating a field will cause a warning:
This is the line that triggers it:
https://github.com/erikras/redux-form/blob/v6/src/asyncValidation.js#L12
The asyncValidate is in the blur handler, this is the line of code that is ignoring the promise.
https://github.com/erikras/redux-form/blob/v6/src/events/createOnBlur.js#L10
I saw that on master,
silencePromise
is used to fix this, however in v6 silencePromise has been removed.The line https://github.com/erikras/redux-form/blob/v6/src/createFieldProps.js#L46
is missing a silencePromise. I think it's still necessary with Bluebird (since it has a detection system for unhandled rejections).
The text was updated successfully, but these errors were encountered: