reduxkotlin / Reselect

A selector library for ReduxKotlin
Apache License 2.0
1 stars 3 forks source link

Store.select() bug #9

Open kaiwidmer opened 4 years ago

kaiwidmer commented 4 years ago

Hi, I discovered that the function store.select is wrapping a subscribe() in a subscribe() and results into strange behaviour.

IS:

fun <State : Any> Store<State>.select(selector: (State) -> Any, action: (Any) -> Unit): StoreSubscriber {
    return subscribe(
        this.selectors {
            select(selector, action)
        }
    )
}

Should:

fun <State : Any> Store<State>.select(selector: (State) -> Any, action: (Any) -> Unit): StoreSubscriber {
    return this.selectors {
        select(selector, action)
    }
}