-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
🐞 Describe the Bug
We have a few components that use LinkTo components but are only used on subroutes with dynamic segments and have not explicitly added @model (e.g. only used within /organizations/:org_id). This works fine in production and up until Ember 3.24 this also worked fine in application and rendering tests.
With 3.24 Ember now automatically starts the routing layer whenever something on the router service is accessed, and now the LinkTo component is complaining that we did not pass the necessary models when any previous thing in the template for example accesses router.currentRouteName.
🔬 Minimal Reproduction
Describe steps to reproduce. If possible, please, share a link with a minimal reproduction.
// router.js
Router.map(function() {
this.route('parent', { path: 'parent/:parent_id' }, function () {
this.route('child');
});
});test('broken', async function(assert) {
// access a property on the router
this.owner.lookup('service:router').currentRouteName;
// render a LinkTo with incomplete model
await render(hbs`<LinkTo @route="parent.child">Link</LinkTo>`);
});😕 Actual Behavior
Assertion Failed: You attempted to generate a link for the "parent.child" route, but did not pass the models required for generating its dynamic segments. Cannot read property 'shouldSupercede' of undefined
🤔 Expected Behavior
The
LinkToshould render without anhreflike it did prior to Ember 3.24, or therouter.currentRouteNameaccess should not have the side-effect of automatically starting the routing layer, which is causing these issues.
🌍 Environment
- Ember: 3.24
➕ Additional Context
somewhat related: