Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selectors created using constructLocalized are loosing the ability to cache from Reselect #24

Open
chalsea5 opened this issue Feb 22, 2019 · 1 comment

Comments

@chalsea5
Copy link

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.

@bguggie
Copy link

bguggie commented Mar 13, 2019

I have seen the same. Are there any plans to address this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants