Incomplete `Transition.to` passed to `routeWillChange` when using `{{#link-to}}` with a model
Given the following route definition:
router.js
Router.map(function() {
this.route('foo', { path: 'foo/:id' });
});
The following application controller:
application/controller.js
import Controller from '@ember/controller';
import { inject } from '@ember/service';
const SOME_MODEL = { id: 123 };
export default Controller.extend({
someModel: SOME_MODEL,
router: inject(),
init(...args) {
this._super(...args);
this.router.one('routeWillChange', ({ to }) => {
console.log(to.params);
});
}
});
And the following application template:
application/template.hbs
{{#link-to "foo" 123}}Click me{{/link-to}}
{{#link-to "foo" someModel}}Click me{{/link-to}}
{{outlet}}
Clicking the first link takes me to http://localhost:4200/foo/123 and produces the following output in the console:
{id: "123"}
which is correct. Clicking the second link also takes me to http://localhost:4200/foo/123, however it produces the following output in the console:
{}
I was expecting these two {{#link-to}} to both produce the same console output.
I dug into this a little as I'm seeing a related issue in our app which is blocking our 3.10 upgrade.
With the above app, when using {{#link-to "foo" 123}}This works{{/link-to}}, we end up in getHandlerInfoForDynamicSegment:

createParamHandlerInfo returns an UnresolvedRouteInfoByParam:

This is then applied to the transition.to and contains the correct params:

With {{#link-to "foo" someModel}}This doesn't{{/link-to}}, we also end up in getHandlerInfoForDynamicSegment:

This time, we return an UnresolvedRouteInfoByObject:

This has empty params which seems like it may be a bug:

When this is applied to the transition.to, you can see that its params are empty:

I have the exact same issue but with the transition.from.params.
I'm on Ember 3.8