Skip to content

Commit

Permalink
make sure prev controller stopped before setting params
Browse files Browse the repository at this point in the history
see:
#1034
  • Loading branch information
cmather committed Dec 16, 2014
1 parent 86bab21 commit ca9db07
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/router_client.js
Expand Up @@ -73,6 +73,13 @@ Router.prototype.dispatch = function (url, context, done) {

this._currentRoute = route;


// even if we already have an existing controller we'll stop it
// and start it again. But since the actual controller instance
// hasn't changed, the helpers won't need to rerun.
if (this._currentController)
this._currentController.stop();

//XXX Instead of this, let's consider making all RouteControllers
// singletons that get configured at dispatch. Will revisit this
// after v1.0.
Expand All @@ -86,12 +93,6 @@ Router.prototype.dispatch = function (url, context, done) {
controller = this.createController(url, context);
}

// even if we already have an existing controller we'll stop it
// and start it again. But since the actual controller instance
// hasn't changed, the helpers won't need to rerun.
if (this._currentController)
this._currentController.stop();

this._currentController = controller;

controller.dispatch(self._stack, url, function onRouterDispatchCompleted (err) {
Expand Down

0 comments on commit ca9db07

Please sign in to comment.