Description
What version of React, ReactDOM/React Native, Redux, and React Redux are you using?
- React: 0.0.0-experimental-e7d0053e6-20220325
- ReactDOM: 0.0.0-experimental-e7d0053e6-20220325
- Redux: 4.2.0
- React Redux: 8.0.2
Here is a Replay recording of this bug with some annotations from me:
http://app.replay.io/recording/replay-failing-reactdevtools-e2e-repro--3351989d-95d4-4035-80af-07d813a623aa
Here is a Loom (it's long) where I use Replay to investigate the problem:
https://www.loom.com/share/3d60c14466184b03acc9af7b80e9eff8
Also note that this issue is specific to an experimental React API, Offscreen
. The React team has published some early documentation about this API but it has not been released in a stable form yet.
What is the current behavior?
A connected component misses updates that are fired while it is inside of a hidden Offscreen
component.
I believe this is because the component unsubscribes when it is unmounting and does not check for missed updates when it is later remounted. (The selectors passed tot he map-state-to-props function were not executed.)
What is the expected behavior?
The expected behavior is perhaps up for debate. Should the component process Store updates (at a lower priority) while hidden or should it wait to render them only if it's later re-shown? In a sense, this question isn't worth debating yet because I don't think React currently provides an API (even an experimental one) to stay subscribed while in a hidden state.
That being said, I think the currently expected behavior is that when then Offscreen
tree is later re-shown, React Redux connect
should check the Store for the latest values and re-render if they have changed since the component was last rendered.
Which browser and OS are affected by this issue?
Presumably all of them
Did this work in previous versions of React Redux?
- Yes