Yarikx/reductor

[Question] listener may be called after unsubscribe?

tmtron opened this issue · 3 comments

when looking at Store, I think it is like this:

is this correct?
if so, then it should at least be mentioned in the doc, because it is not something a user would expect, right?

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