Skip to content

Commit 376c668

Browse files
committed
Fixed remix-run#193 by allowing nested arrays of routes
1 parent cc606fa commit 376c668

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

modules/components/Routes.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,20 @@ function Redirect(to, params, query) {
242242
this.query = query;
243243
}
244244

245-
function findMatches(path, route) {
245+
function findMatches(path,route){
246+
var matches = null;
247+
if(Array.isArray(route)){
248+
for (var i = 0, len = route.length; matches == null && i < len; ++i) {
249+
matches = findMatches(path, route[i]);
250+
}
251+
}else {
252+
matches = findMatchesForRoute(path,route);
253+
}
254+
255+
return matches;
256+
}
257+
258+
function findMatchesForRoute(path, route) {
246259
var children = route.props.children, matches;
247260
var params;
248261

0 commit comments

Comments
 (0)