> The intended guarantee is that Redux eventual...
# redux
a
The 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 bugs
🤔 1
p
Looks like there is/was interest in changing this in redux. check out the thread https://github.com/reduxjs/redux/issues/1707 last comment is Dan Abramov
r
I think there is no point in keeping this similarity to JS redux. To have the state parameter would be just better solution.
a
This 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
The people who made ReduxJs aren't dumb. They kept it separate for a reason, so I'd like to fully understand their reasoning before departing from their decisions
đź’Ż 1
p
Agree with that. Will continue to look at this going forward. I don't think it is a big difference for the client code either way, and I'm kind of indifferent. I do want to explore reduxkotlin + react before changing any type definitions.