diff --git a/modules/AsyncProps.js b/modules/AsyncProps.js index 4dc7880..0c695c0 100644 --- a/modules/AsyncProps.js +++ b/modules/AsyncProps.js @@ -26,7 +26,7 @@ function filterAndFlattenComponents(components) { return flattened } -function loadAsyncProps({ components, params, loadContext }, cb) { +function loadAsyncProps({ components, params, location, loadContext }, cb) { let componentsArray = [] let propsArray = [] let needToLoadCounter = components.length @@ -44,7 +44,7 @@ function loadAsyncProps({ components, params, loadContext }, cb) { maybeFinish() } else { components.forEach((Component, index) => { - Component.loadProps({ params, loadContext }, (error, props) => { + Component.loadProps({ params, location, loadContext }, (error, props) => { const isDeferredCallback = hasCalledBack[index] if (isDeferredCallback && needToLoadCounter === 0) { cb(error, { @@ -93,10 +93,11 @@ function createElement(Component, props) { return } -export function loadPropsOnServer({ components, params }, loadContext, cb) { +export function loadPropsOnServer({ components, params, location }, loadContext, cb) { loadAsyncProps({ components: filterAndFlattenComponents(components), params, + location, loadContext }, (err, propsAndComponents) => { if (err) { @@ -223,8 +224,8 @@ const AsyncProps = React.createClass({ return const { enterRoutes } = computeChangedRoutes( - { routes: this.props.routes, params: this.props.params }, - { routes: nextProps.routes, params: nextProps.params } + { routes: this.props.routes, params: this.props.params, location: this.props.location }, + { routes: nextProps.routes, params: nextProps.params, location: nextProps.location } ) const indexDiff = nextProps.components.length - enterRoutes.length @@ -261,6 +262,7 @@ const AsyncProps = React.createClass({ loadAsyncProps({ components: filterAndFlattenComponents(components), params, + location, loadContext }, this.handleError((err, propsAndComponents) => { const reloading = options && options.reload @@ -287,8 +289,8 @@ const AsyncProps = React.createClass({ }, reloadComponent(Component) { - const { params } = this.props - this.loadAsyncProps([ Component ], params, null, { reload: true }) + const { params, location } = this.props + this.loadAsyncProps([ Component ], params, location, { reload: true }) }, render() {