-
-
Couldn't load subscription status.
- Fork 677
Description
When we want to pass an argument to a selector, like props.narrow to getRenderedMessages, we currently do so in a way that totally defeats Reselect's caching. We should fix this.
See discussion in chat. In particular, on what to do instead:
The solution recommended in the Reselect docs is to push the inspection of
propsinside the selector:
https://github.com/reduxjs/reselect#accessing-react-props-in-selectorsI don't love that solution -- it feels awfully implicit to me. [...] I'd much rather stick to passing specifically the narrow down to the selectors, like we currently do.
I guess there's nothing in the Reselect code (AFAICT) that depends on that "props" argument actually being the
propsof any React component. So we could just saygetRenderedMessages(state, props.narrow), and have all the...ForNarrowselectors take a second argument of typeNarrow, and that may just all work great.(We'd be treating that
Narrowas what the Reselect docs expect to be "props".)
So instead of defining selectors so that their call sites look like getRenderedMessages(props.narrow)(state), we should define them so they're called like getRenderedMessages(state, props.narrow).
I don't think this is currently a top priority, though.