-
Notifications
You must be signed in to change notification settings - Fork 35
-
Notifications
You must be signed in to change notification settings - Fork 35
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
middlewares and reducers notifications #13
Comments
If you see the typical redux cycle, it has both reducers and middleware will be triggered for every action dispatch. This is by design. Please refer - https://blog.gisspan.com/2017/02/Redux-Vs-MVC,-Why-and-How.html |
Thanks for the link, I find it very illustrative. However, the diagram shows a single View subscribed to a particular state and getting update by the middlewares + reducers chain. My question related to many views co-existing in an application (1 I doubt whether this also happens in ReSwift. Do you happen to know this? |
@pablodeafsapps |
Thanks for your comments, @jitinsharma Reached this point, there is only one main drawback I am facing right now: my Activity/Fragment files (i.e. UI) are growing way too much. Coming from MVP and VIPER, where the presenter handles any action performed over the View, it looks a bit untidy to me having Activity instances so full of code. I guess there are best practices on how to use ReKotlin, but some tips would be appreciated... ;) |
hi @pablodeafsapps , I'm using ReKotlin right now and I have used ReSwift before. It is true that not all apps are suitable for this pattern but it is something you have to decide, together with you preferences about how to write code (more or less functional) . I wrote a post about it recently, hope it helps a bit. Using Reswift and iOS you don't have to think too much because the state is kept in memory the whole time, but in Android you should take in account activities lifecycle, etc. IMO a single activity app is a better setup but again, it is another decision you'll have to take ;) |
@pablodeafsapps |
Not sure about Presenter, @jitinsharma. I mean, it will clean up my code by adding a new "layer" to my architecture, with not a "real" Presenter though. A Presenter coordinates the whole action in MVP, getting updates from the View and querying the Model when needed. Since ReKotlin is based on unidirectional flow architectures, I guess this Presenter-ish will not make sense. Again, this is a guess, and even so I still like your idea of a layer/class abstracting state subscriptions, so they get removed from Activity/Fragment instances. |
@pablodeafsapps Can we close this issue? |
@pablodeafsapps Closing this issue for now, as no further action is needed, if anyone comes up with a way to solve this, feel free to raise a PR |
Hi! I happen to be developing an app using this library (thanks for this, btw!) and, after a thorough debugging process, I have spotted that all my reducers and middlewares get called on every new
Action
dispatch.Thus, regardless which
Activity
orFragment
I am, anystore.dispatch(MyAction())
triggers all reducer and middleware instances (I guess this means that I could even define all reducers and middlewares in the same file). Apart from finding this a bit inefficient, I wonder whether this is the only way to do it or there is a smarter approach.Thanks and regards,
The text was updated successfully, but these errors were encountered: