Skip to content

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

@chalsea5

Description

@chalsea5

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions