ember-angle-brackets-codemod icon indicating copy to clipboard operation
ember-angle-brackets-codemod copied to clipboard

Incorrect handling of block param properties in iterable helpers

Open ctaylor-nurx opened this issue 3 years ago • 2 comments

Ex: Input

                  {{#each model.promoRedemption as |promoRedemption|}}
                    <tr>
                      <td>{{promoRedemption.redeemedAt}}</td>
                      <td>{{promoRedemption.request.id}}</td>

Output

                  {{#each model.promoRedemption as |promoRedemption|}}
                    <tr>
                      <td><promoRedemption.redeemedAt /></td>
                      <td><promoRedemption.request.id. /></td>

ctaylor-nurx avatar Sep 14 '21 22:09 ctaylor-nurx

nice one! I'm not sure when I can get to it but hopefully it's not that hard. PR's are welcome.

tylerturdenpants avatar Sep 15 '21 15:09 tylerturdenpants

this issue is that yielded components and regular old data renderings are the same in curly brace notation. The thing to look for is differentiating between iterable helpers and yielded components.

Here's the yielded component example

              {{ember-table as |table|}}
                {{table.head
                  columns=columnNames
                  sorts=sorts
                  onUpdateSorts=(action (mut sorts))
                  sortEmptyLast=true
                  widthConstraint="eq-container"
                }}
{!-- to --}
              <EmberTable as |Table|>
                <Table.head
                  @columns={{columnNames}}
                  @sorts={{sorts}}
                  @onUpdateSorts={{action (mut sorts)}}
                  @sortEmptyLast={{true}}
                  @widthConstraint="eq-container"
                />

ctaylor-nurx avatar Sep 15 '21 16:09 ctaylor-nurx