-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
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
Action Creators: unwrap Promise with Action #215
Comments
Sorry I didn't figure out what branch I can use to add this feature. But I'll be glad to make a PR. |
This can and should be implemented outside of the core using middleware. You can read more about middleware here (docs improvements are impending). Check out redux-promise, which looks like it fits your needs: https://github.com/acdlite/redux-promise |
What the purpose not to implement it in the core? It can be straightforward change that will only simplify development workflow. Also, I expected this feature as an obvious solution that should be available without any additional plugins/middlewares/another-shittiest-type-of-modules. |
I agree it's a natural feature that most Redux apps will probably want to have, but once we put it into the core, everyone will start bikeshedding exactly how it should work, which is what happened for me with Flummox. We're trying to keep the core as minimal and flexible as possible so we can iterate quickly and allow others to build on top of it. Also, even if we did implement it in the core, it'd be in exactly the same way we're recommending now — as a layer on top of |
The idea to describe AC as pure functions is good but it has one disadvantage. It looks good only for sync stuff.
The main purpose of using AC is to isolate asynchronous stuff from other parts of architecture (like view layer and stores layer). And based on my experience on projects with server side (or another types of WebAPI that you can use) you will create a lot of async AC. So it would be better if the developer will be able to write async AC easy just like sync one.
Currently, I need to wrap all my async operations and use
dispatch
function as a side effect.Lets accept Promises and unwrap them to get Action instance
I think it's a way to full consistency and purity.
The text was updated successfully, but these errors were encountered: