-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Description
From reactjs/react-router-redux#197.
This issue arises when using a Flux integration for React Router. The issue is that, if the integration updates e.g. Flux stores when history
updates, this will lead to a separate setState
(in e.g. smart component containers, from the store update) from the setState
in <Router>
(from the transition manager update directly), which will lead to the page rendering twice.
We could in principle resolve this by using ReactDOM.unstable_batchedUpdates
in useRouterHistory
. We can't really do this in history
because that library is not aware of React. I think it'd make more sense to do it here rather than in every React Router integration, because otherwise they'd all need the same logic.
The downsides of course are:
- We now call into an unstable API
- We introduce an explicit
react-dom
dependency (for now) when currently there isn't one
cc @gaearon, in case this is a horrible anti-pattern if used in conjunction with Redux