createStructuredSelector and selectors with logical OR

123 views Asked by At

we recently moved to reselect lib. so we have mixed data structure in mapStateToProps.

I use createStructuredSelector as next, and here is the problem:

const mapStateToProps = state => ({
  someProp: state.someProp,
  ...createStructuredSelector({
    pending: selectIsPending_1 || selectIsPending_2,
  })(state)
})

selectIsPending_1 returns true only during initial load. Later - always false.

selectIsPending_2 is never reached, so in result I get always false in pending prop

How can I use this OR operator in this case?

as a workaround, inside createStructuredSelector:

    pending: () => selectIsPending_1(state) || selectIsPending_2(state),
0

There are 0 answers