gaearon / gaearon/react-deep-force-update

Using react-redux connect deep force update does not work

Open
#2 2 comments 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
120
Forks
19
PR merge metrics
No merged PRs in 30d

Description

forceUpdate is ignored by react-redux connect. Because internally a `renderedElement`is stored and forceUpdate does not reset this element, leading to rendering an possibly 'old' component. A fix could be like adding this code to `deepForceUpdate`. Or update react redux connect to handle `forceUpdate`.

```
traverseRenderedChildren(node, internalInstance => {
const instance = internalInstance._instance;
if (instance && instance.renderedElement) {
instance.renderedElement = null;
}
});
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating deepForceUpdate and the traversal of rendered children, then inspect how react-redux connect stores renderedElement. Reproduce the forceUpdate case described in the issue and compare the behavior with the proposed reset. Done means connected components no longer render an old element after a deep force update.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react, redux
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.