dependant shared selectors
Hi,
I have two shared selectors: makeGetAbsGeo, makeGetDragStatus. (Actually I have three shared selectors, but the two should be enough to explain the problem). The first selector calculates the position and size (absoluteGeometry) of an element, the second one calculates the current drag state of the same element. If the dragState has some specific value, the absGeo has to be recalculated.
My current implementation:
makeMapStateToProps = () => {
const getAbsGeo = makeGetAbsGeo(),
getDragStatus = makeGetDragStatus();
return (state, props) => {
let absGeo = getAbsGeo(state, props),
dragStatus = getDragStatus(state, props);
if (dragStatus) {
absGeo = // do some further calculations depending on the drag status
}
return {
absGeo, dragStatus
}
}
}
And here is my problem: The recalculations of the absGeo object depending on the drag status shouldn't be in the component, but in a selector. (The case above looks pretty clean, but that's only a simplification of my problem.) If I would call the getDragStatus selector from within the getAbsGeo selector, it defies the purpose of the shared makeGetDragStatus selector. Also I can't merge the two selectors into one, because I need the dragStatus in the component, too.
Is there a way to somehow nest or link shared selectors? Or maybe another solution to my problem?
(I hope I described my problem in a comprehensible way .. it's rather tricky to explain)
Closing due to inactivity