-
Notifications
You must be signed in to change notification settings - Fork 1
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
if side effects of action throw error, state of model will be wrong #7
Comments
Thank you for sharing love True. I guess it’s a normal javascript behavior. You get notified by error that the action has failed (usually means that you need to fix your handlers or side effects which you supplied to cofi), and its only normal that it won’t continue to the side effects like “afterChangeValue” if changeValue for example has failed. I think that if we do run the effects if the action fails, it can cause unexpected behavior in the system that uses cofi, since it expects the afterChangeValue to run after the value has changed successfully. Do you have an alternative way to handle it? Perhaps we can add a note in the error which says that side effects didn’t complete? |
MDN web docs say:
It means that one of promise is failed, others promise will stop immediately. So the result is not just ignore this promise, the state is unexpected totally. |
The common scene: async validator throw error or timeout. Maybe we can just deal this scene at first. |
One method: |
@WangLarry |
Describe the bug
In processQueue function, catch error of actions, then run following codes. It means that side effects are not ran totally, state is not complete.
To Reproduce
In custom validator function, throw error or timeout.
The text was updated successfully, but these errors were encountered: