You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem I see with this is that (unless the promise rejects) React.render will always be called, even if a new state came in the meantime. And if that newer state was already rendered, the UI will end up in an inconsistent state (browser URL and internal router state will differ from the manually set props). If you click fast enough in the example, you may end up seeing a different profile than the one you clicked last which is also reflected in the current URL.
This doesn't only affect async rendering, but can also happen when transitioning before a render:
Router.run(routes,function(Handler,state){this.transitionTo(..);// state is now stale and not consistent with the router state / URLReact.render(<Handlerdata={getDataFromState(state)}/>,document.getElementById('example'));});
A solution to this would be to keep track of the active state yourself:
The async-data example suggests the following approach for fetching data async before render:
The problem I see with this is that (unless the promise rejects) React.render will always be called, even if a new state came in the meantime. And if that newer state was already rendered, the UI will end up in an inconsistent state (browser URL and internal router state will differ from the manually set props). If you click fast enough in the example, you may end up seeing a different profile than the one you clicked last which is also reflected in the current URL.
This doesn't only affect async rendering, but can also happen when transitioning before a render:
A solution to this would be to keep track of the active state yourself:
So I think that either this approach should be promoted, or the router should provide a way to check if
state
is still active.The text was updated successfully, but these errors were encountered: