-
Notifications
You must be signed in to change notification settings - Fork 517
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
Store.ActionCreator , Store.AsyncActionCreator and Middlewares #75
Comments
Generally this would be a job for middleware. However, there are two specific reasons we have chosen to implement them as separate methods on the store:
An additional note on 2., we are looking for a better default way for async in Lastly:
I think in this case it's not worth introducing a new type. We are borrowing the middleware API from Redux (which makes it easier for some folks to understand the mechanism) and I would only want to deviate from it if we can add significant value. I don't think that's the case for this suggestion. Thanks a lot for contributing your questions & ideas 👍 |
@Ben-G Thanks for your detailed explanation. |
Actually I have a question about this too :) I perfectly understand the value of that callback for asynchronous version of |
I agree on the latest comment. The callbacks on the synchronous dispatch methods don't make a lot of sense. They were added for consistency but don't add a lot of value. We should likely remove them soon! You are right that they encourage to use the library in an undesirable way. |
Using ReSwift there should never be a reason for needing a callback upon state update for synchronous dispatches. This was correctly pointed out in #75.
Using ReSwift there should never be a reason for needing a callback upon state update for synchronous dispatches. This was correctly pointed out in #75.
As far as I understand, all overloads of
Store.dispatch
that using bothStore.ActionCreator
andStore.AsyncActionCreator
types wrap_defaultDispatch
actually. It seems like a job for middlewares, isn't it?BTW, why does
Middleware
take references todispatch
andgetState
separately? Maybe it is worth to extract both fromStoreType
to someStoreCoreAPIType
and pass it by weak reference.P.S.
ReSwift
is very interesting framework 👍The text was updated successfully, but these errors were encountered: