Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"peerDependencies": {
"react": "^0.14.0-beta3",
"react-relay": "^0.2.0",
"react-router": "1.0.0-beta3"
"react-router": "^1.0.0-beta4"
},
"devDependencies": {
"babel": "^5.8.23",
Expand All @@ -47,7 +47,7 @@
"eslint-plugin-react": "^3.3.0",
"react": "^0.14.0-beta3",
"react-relay": "^0.2.0",
"react-router": "1.0.0-beta3",
"react-router": "^1.0.0-beta4",
"rimraf": "^2.4.3"
}
}
11 changes: 8 additions & 3 deletions src/RouteAggregator.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ export default class RouteAggregator {
}

updateRoute(routerProps) {
const {branch, params, location} = routerProps;
const {params, location} = routerProps;

// TODO: Replace this hack with a proper way of reading routes.
const {routes} = location;
location.hasRoutes = true;
console.log(routes);

const relayRoute = {
name: null,
Expand All @@ -28,7 +33,7 @@ export default class RouteAggregator {
};
const fragmentSpecs = {};

branch.forEach(route => {
routes.forEach(route => {
const {queries} = route;
if (!queries) {
return;
Expand All @@ -47,7 +52,7 @@ export default class RouteAggregator {
component.displayName || component.name
);

const routeParams = getParamsForRoute({route, branch, params, location});
const routeParams = getParamsForRoute({route, params, location});
Object.assign(relayRoute.params, routeParams);

Object.keys(queries).forEach(queryName => {
Expand Down
6 changes: 6 additions & 0 deletions src/createElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ import React from 'react';
import Container from './Container';

export default function createElement(Component, props) {
// TODO: Replace this hack with a proper way of reading routes.
if (!props.location.hasRoutes) {
const childRoutes = props.location.routes || [];
props.location.routes = [props.route, ...childRoutes];
}

return (
<Container
Component={Component}
Expand Down
6 changes: 3 additions & 3 deletions src/getParamsForRoute.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {getRouteParams} from 'react-router/lib/RoutingUtils';
import getRouteParams from 'react-router/lib/getRouteParams';

export default function getParamsForRoute({route, branch, params, location}) {
export default function getParamsForRoute({route, params, location}) {
const paramsForRoute = {};

// Extract route params for current route and all ancestors.
for (const branchRoute of branch) {
for (const branchRoute of location.routes) {
Object.assign(paramsForRoute, getRouteParams(branchRoute, params));
if (branchRoute === route) {
break;
Expand Down