ember.js: [2.15.0] {{link-to}} inside a partial stopped working

After upgrading to 2.15.0 some of our tests started failing because a {{#link-to}} inside of a partial stopped working.

This is the {{link-to}} in question. When rendering there are no immediate errors but the generated href is just # and the data-test-user-id attribute is not output when testing. Clicking the link outputs this warning:

This link-to is in an inactive loading state because at least one of its parameters presently has a null/undefined value, or the provided route name is invalid.

Everything else inside of the partial still renders fine, it’s just the link-to that fails.

Changing the partial to a component fixed the problem.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 8
  • Comments: 25 (12 by maintainers)

Most upvoted comments

Reproduction in 2.15. Same twiddle working in 2.14.

Ember 2.16.1 has been released which should fix the issues with partials. Please let me know if you’re still seeing issues

FYI - The upgrade to Glimmer 0.29 is a large effort (and unlikely to happen before Ember 3.0.0), @chadhietala backported the fix to the 0.25 branch. We need to release that as a patch version and update to that version instead. I’ll try to get these releases done today…

The same thing happens with an #each iteration. The value from #each isn’t passed to the context of the partial.

{{#each visibleContent as |record index|}}
  {{partial rowTemplate}}
{{/each}}

Both record and index are undefined in the partial.

we are also unable to upgrade due to this bug. similar to @thec0keman we have a fairly large ember app which was originally started using EAK, so there’s still some lingering legacy functionality that we haven’t yet brought to modern ember

we don’t have a lot of partials left, but enough that this is a blocker for us until we have the time to migrate / test the remaining partials to components

This one should really get some higher priority, partials are broken since 2.15 and prevent people to upgrade from 2.14 to 2.16.

No, this isn’t legacy behavior per-se, but it is fairly uncommon. You should totally migrate to using components whenever you can (it is massively simpler to reason about), but we should absolutely fix this ASAP.

Is this behavior legacy, or is there an alternative approach that should be considered? We’ve been trying to use components over partials, but for our largish app there are still many instances where this bug is breaking things. At this point, we are blocked from upgrading, and I am surprised this isn’t affecting more folks.

A new glimmer version with the fix was released. After updating the glimmer version this bug should be fixed. I’ve opened a pull request for updating the glimmer version.

I’ve come across a similar problem in 2.15, it seems that a partial rendered inside a yielded block from a component doesn’t receive the yielded parameters from that component.

Example:

// -name.hbs
<p>{{name}}</p>

component.js

export default Component.extend({
  name: "Ivan"
})

template.hbs

{{yield name}}

some-route-template.hbs

{{#my-component as |name|}}
  {{partial "name"}}
{{/my-component}}

In this instance, the {{name}} variable in the partial is undefined.

It is not. Ember 2.15 is not an LTS, so I don’t think a fix will be coming.

The same problem also exists if using the with helper:

{{#with someProperty as |youNameIt|}}
  {{partial somePartial}}
{{/with}}

Probably the patch will fix this too, but to be sure I do mention it here!

@rwjblue LMK if there is anything that i can help with the release which includes the patched 0.25 branch (as I’m working on upgrading Intercom at the moment). As far as I can tell, it hasn’t yet reached ember canary