glung/redux-java

change notifyStateChanged call order

Closed this issue · 1 comments

if a subscriber unregister itself while onStateChanged, some subscribers can't get notified

private void notifyStateChanged() {
    for (int i = 0, size = subscribers.size(); i < size; i++) {
        subscribers.get(i).onStateChanged();
    }
}

should be

private void notifyStateChanged() {
    for (int i = subscribers.size()-1; i >=0; i--) {
        subscribers.get(i).onStateChanged();
    }
}
glung commented

Hello, I am closing it should be fixed in the new version (1.0)