Closed tmtron closed 7 years ago
Hi, good question. Yes. The idea was to keep the Redux semantics as close as possible. http://redux.js.org/docs/api/Store.html#subscribelistener
The subscriptions are snapshotted just before every dispatch() call. If you subscribe or unsubscribe while the listeners are being invoked, this will not have any effect on the dispatch() that is currently in progress. However, the next dispatch() call, whether nested or not, will use a more recent snapshot of the subscription list.
This allows calling cancel
while dispatch is still in progress.
But you are right about mentioning it in docs. If you want you can submit PR.
hi, thanks for the fast response.
I was not aware, that Conductor is so close to Redux. In this case, I guess that it is enough to know, that the redux.js docs will apply to Conductor code (unless otherwise noted).
Thanks
Conductor is different Android library, not related to Redux
when looking at Store , I think it is like this:
listeners
is a CopyOnWriteArrayList - so the for loop indispatchAction()
may still iterate over the "old" list and thelistener
may be called after it has already unsubscribedis this correct?
if so, then it should at least be mentioned in the doc, because it is not something a user would expect, right?