Selectors created using constructLocalized are loosing the ability to cache from Reselect
chalsea5 opened this issue · comments
Example of the selector with constructLocalized
selectors: constructLocalized({
items: state => state.items, // gets the items from state
subTotal: new Duck.Selector(selectors =>createSelector( // createSelector from Reselect
selectors.items(state),
items => items.reduce((computedTotal, item) => computedTotal + item.value, 0)
))
})
subTotal here is always being computed instead of returning cached result. The last arguments required for the defaultMemoize in createSelector to compare with current arguments is null in this case.
Example of selector without constructLocalized
selectors: {
items: state => state.items, // gets the items from state
subTotal: new Duck.Selector(selectors =>createSelector( // createSelector from Reselect
selectors.items(state),
items => items.reduce((computedTotal, item) => computedTotal + item.value, 0)
))
}
subTotal here is returned from cache.
I think there is an issue with constructLocalized that is influencing this to happen.
I have seen the same. Are there any plans to address this?