andreworobator
08/28/2019, 5:24 PMThe intended guarantee is that Redux eventually calls all subscribers with the most recent state available, but not that it always calls each subscriber for each action. The store state is available in the subscriber simply by calling store.getState()This explanation is more about disallowing the action in the subscriber which i totally get and support. but having the most recent state in the subscriber could be easily solved with
(State) -> Unit
and you could eliminate a whole class of bugsPatrick Jackson
08/28/2019, 6:25 PMRobert Jaros
08/28/2019, 6:28 PMandreworobator
08/28/2019, 6:30 PMThis has been discussed before: #303. subscribe() and getState() are orthogonal on purpose so if you “override” one in a store enhancer, you don’t need to override the other.
In any case, having just the new state is not very useful. You’ll probably want the previous state too. And not just the previous state—probably a specific part you care about. At which point you might as well write your own helper to do this.
See #303 (comment) for more details.From https://github.com/reduxjs/redux/issues/1513 This is the argument for keeping them separate, but I don't know enough about StoreEnhancers atm
andreworobator
08/28/2019, 6:34 PMpatjackson52
08/28/2019, 7:17 PM