Closed
Description
This one has been asked about for a while, particularly by @theKashey :
- Reselect v5 Roadmap Discussion: Goals and API Design #491 (comment)
- https://twitter.com/keeslinp/status/1656342003268071424
The idea is that users sometimes end up writing badly-written selectors that accidentally recalculate the results every time. This is primarily due to badly-written input functions, such as:
createSelector(
state => ({ foo: state.foo, bar: state.bar }),
({ foo, bar }) => ({result: foo + bar})
)
Since the input function always returns a new object, the output function will always run and return a new reference.
Probably the simplest thing we can do here would be to double-run the input functions twice and verify that the results are shallow equal.
Metadata
Metadata
Assignees
Labels
No labels