Why forcing update of the whole tree?
- Dominant language
- JavaScript
- Stars
- 453
- Forks
- 43
- PR merge metrics
- No merged PRs in 30d
Description
One could call forceUpdate just on the updated mounted instances. This way the amount of calls to render would be minimized and (more importantly) the reference to the root of the tree would become unnecessary.
I tried adding these lines at #createClassProxy.js:176 (branch 2.0.8) and it seems to work fine:
(code adapted from react-deep-force-update)
```javascript
mountedInstances.forEach((publicInstance) => {
if (typeof publicInstance.forceUpdate === 'function') {
publicInstance.forceUpdate();
} else if (publicInstance.updater && typeof publicInstance.updater.enqueueForceUpdate === 'function') {
publicInstance.updater.enqueueForceUpdate(publicInstance);
}
});
```
~and seems to be a tiny bit faster.~
Update:
I tested it in a real project: up to 5 times faster, no issues found, no react router warnings anymore.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.