Commit c89794caeffafc465f3dd30e6a332ec2581775ec
defer fetch till next tick
this way we don't fetch during a render and annoy reactMichael Williams committed on 1/8/2016, 5:50:45 AM
Parent: 5aaa7567ce018bfe4ea54d34371929683870a809
Files changed
app/util/fetch-element.js | changed |
app/util/fetch-element.js | ||
---|---|---|
@@ -2,12 +2,14 @@ | ||
2 | 2 | |
3 | 3 | export default function fetchElement (store) { |
4 | 4 | return function (Component, props) { |
5 | 5 | if (Component.fetchData) { |
6 | - Component.fetchData( | |
7 | - store.getState, store.dispatch, | |
8 | - props.location, props.params | |
9 | - ) | |
6 | + process.nextTick(function () { | |
7 | + Component.fetchData( | |
8 | + store.getState, store.dispatch, | |
9 | + props.location, props.params | |
10 | + ) | |
11 | + }) | |
10 | 12 | } |
11 | 13 | return React.createElement(Component, props) |
12 | 14 | } |
13 | 15 | } |
Built with git-ssb-web