Closed mickorand closed 5 years ago
Ah, this is potentially a difference between react-redux v6 and v7 that I did not factor in when specifying the allowed versions. In the current version of react-redux, there is no storeState
in the context. Is it possible for you to update to v7.1.1 and seeing if that works for you?
I don't think there is be any huge issue in providing the additional value to the context to support v6 still, but we will soon be making a change to use a new Provider
instead of messing around with the context directly. There was a bug in Provider
that prevented us from doing this initially, which has now been fixed, so we are going to make that switch soon and drop v6 support all together, so it may be in your best interest to update anyway, even if just for the performance improvements.
Yup that helped. Thanks for the quick response.
Made a PR to update the peerDependencies
.
Updated peerDependency
was released in v5.0.0.
Is it a bug, feature request or question?
Bug
Which package(s) does this involve?
react-redux / react-redux-subspace
Input Code
I'm not sure if the actual code matters, but here's an idea of setup (it's pretty basic on it's own):
State:
Parent (multiple filtered lists in a scroll view):
Child (given the provided filter dispatches the request and waits for data back):
Expected Behavior
Expecting to receive next type of object in mapToState function of FilteredList component:
Current Behavior
Receiving next type of object in mapToState function of FilteredList component:
Possible Solution
Checked the setup multiple times and switched to debugging. It appears to me that the issue dwells in between
react-redux-subspace
andreact-redux
.Namely,
SubspaceProvider
fromreact-redux-subspace
updates the store for its children here:Please mention that we only update the
store
in thecontextValue
, but not thestoreState
. Whereas in thereact-redux
we use thestoreState
. Namely, in the linevar nextProps = sourceSelector(state, props)
:It looks like adding
storeState: store.getState()
inuseReplacedContext
function fixes the problem:Your Setup
Context
It might be that I'm doing something wrong, but I rechecked the examples and my code somewhat 10 times now and ask a colleague to do so as well to be sure. It seems that everything is according to usage examples, yet the situation described above happens. In case my understanding of how it's supposed to work is wrong (e.g.
storeState
should carry on the global state) please advise how it supposed to be.