Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAllow selector dependencies to be selector factories #321
Conversation
coveralls
commented
Feb 9, 2018
•
codecov-io
commented
Feb 10, 2018
Codecov Report
@@ Coverage Diff @@
## master #321 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 1 1
Lines 15 16 +1
=====================================
+ Hits 15 16 +1
Continue to review full report at Codecov.
|
toomuchdesign
commented
Feb 18, 2018
|
Hi @madcapnmckay, just to point out that This allows forgetting differences between selectors and selector factories. |
abritinthebay
commented
Sep 28, 2018
|
@toomuchdesign while true, that's somewhat different to the proposed solution. |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

madcapnmckay commentedFeb 9, 2018
•
edited
As noted in the docs, if you are not careful, memoization can be undone when using a selector with props in multiple components.
The solution is to use a selector factory and pass that to mapStateToProps instead. This works well for one level deep selectors, however, if we are composing memoized selectors the same caveats apply. It is very easy to unintentionally undo the memoization as we nest. The solution again is to keep wrapping our sub-selectors in factories and executing them as we create the selectors.
A neater approach is to always accept either a selector or a selector factory in the createSelector function and handle it in a similar manner as react-redux connect does. This would allow us nest selector factories without having to explicitly execute the factory.
This change means the way selectors are used is identical whether they are
For example:
I realize this PR is incomplete, I just wanted to get people's opinion on the change.