ember.js icon indicating copy to clipboard operation
ember.js copied to clipboard

Minor upgrade pain - change in variable shadowing behavior in Glimmer 2?

Open marisawallace opened this issue 9 years ago • 2 comments

Low-priority issue, feel free to close if it's not helpful.

I'm reporting this because it was a minor source of upgrade pain / confusion for me when upgrading to Ember 2.10.0, and it's worth documenting if I can save others time.

The problem (worked in 2.9, broken in 2.10.0):

{{foo-component as |attrs|}}
  {{bar-component bar=attrs.foo}}
{{/foo-component}}

The fix (works in 2.10.0):

{{foo-component as |value|}}
  {{bar-component bar=value.foo}}
{{/foo-component}}

This is really my fault for using attrs as a variable name in a template. That said, it looks like something changed in Glimmer 2 to stop the block-scoped attrs from shadowing the attrs of the parent Component.

marisawallace avatar Dec 05 '16 14:12 marisawallace

Definitely something we should fix. We do this here, where we basically transform anything with the literal value attrs into a different (private API) format.

rwjblue avatar Dec 05 '16 15:12 rwjblue

We should ideally be tracking block params to ensure we are not breaking as |attrs|}} for folks...

rwjblue avatar Dec 05 '16 15:12 rwjblue