Skip to content

Commit

Permalink
Copyedit tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
taion committed Oct 29, 2016
1 parent 6d5ab65 commit 9a3082b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/resolveElements.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function createElements(routeMatches, Components, matchData) {
const data = matchData[i];

const isComponentResolved = isResolved(Component);
const isDataResolved = isResolved(data);
const areDataResolved = isResolved(data);

if (route.render) {
// Perhaps undefined here would be more correct for "not ready", but
Expand All @@ -23,17 +23,18 @@ function createElements(routeMatches, Components, matchData) {
return route.render({
match,
Component: isComponentResolved ? Component : null,
props: isDataResolved ? { ...match, data } : null,
data: isDataResolved ? data : null,
props: areDataResolved ? { ...match, data } : null,
data: areDataResolved ? data : null,
});
}

if (!isComponentResolved || !isDataResolved) {
if (!isComponentResolved || !areDataResolved) {
// Can't render.
return undefined;
}

if (!Component) {
// Note this check would be wrong on potentially unresolved data.
warning(
data === undefined,
`Route ${i} has data, but no render method or component.`,
Expand Down

0 comments on commit 9a3082b

Please sign in to comment.