why angular-ui new state router transitions when only parameters changes?

I'm using the new angular-ui router, the one that has a state-machine included (https://github.com/angular-ui/ui-router). This great router allows a user to specify parameters as part of the URL.

for example:

$stateProvider
    .state('contacts.detail', {
        url: "/contacts/:contactId",
        templateUrl: 'contacts.detail.html',
        controller: function ($stateParams) {
        // If we got here from a url of /contacts/42
        expect($stateParams).toBe({contactId: 42});
    }]
})

(see here)

this means, that when the user navigates to /contacts/42, the state is changed to 'contacts.details' and the 42 parameter is injected into the controller

There is a problem though. If ONLY the url parameter changes, the transitionTo function is still being called (could happen if the url is changed manually, for example, or bound to a input box). this in turn leads to the view directive of that state, to be re-created, both a waste of time and a problem if we only wanted to update something in that state.

it seems to be on purpose. from the code:

  // Starting from the root of the path, keep all levels that haven't changed
  var keep, state, locals = root.locals, toLocals = [];
  for (keep = 0, state = toPath[keep];
       state && state === fromPath[keep] && equalForKeys(toParams, fromParams, state.ownParams);
       keep++, state = toPath[keep]) {
    locals = toLocals[keep] = state.locals;
  }

equalForKeys is what compares the params, and return false if there's a difference.

My question: do you know why the author would have written it this way? do you think its safe to change, so that there's no transition when only parameters would change?

thanks very much for reading all the way till here, and for any idea

Lior

EDIT: Seems that this is by design. just found: https://github.com/angular-ui/ui-router/issues/46

I generally solve problems of this nature with abstract states and nesting. Place the pieces that don't change based on the url parameter into the abstract parent state and you'll avoid the extra server hit. I prefer to place them into the resolve or custom data section in the parent state, but if necessary you can retrieve them via scope inheritance. Be sure you read and understand the rules of scope inheritance as there are some things that (at least for me) were unexpected.

You can read more details here: https://github.com/angular-ui/ui-router/wiki/Nested-States-%26-Nested-Views. In addition, the sample application included with angular-ui is a good place to start understanding state nesting.