Skip to content

Commit

Permalink
route: 及早返回
Browse files Browse the repository at this point in the history
  • Loading branch information
magicdawn committed Nov 28, 2015
1 parent 83a97b6 commit 59b3f2c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ Route.prototype.dispatch = function*(next, ctx) {
}

yield * findNext();
yield * next; // 如果一个 route 没有调用 next, 后续route不会受影响

function* findNext() {
if (idx === stack.length) {
yield * next; // end of route, find next_route
return;
}

Expand All @@ -130,6 +130,7 @@ Route.prototype.dispatch = function*(next, ctx) {

// end Route
if (idx === stack.length) {
yield * next; // end of route, find next route
return;
} else {
continue;
Expand Down

0 comments on commit 59b3f2c

Please sign in to comment.