Skip to content

Commit cc75067

Browse files
committed
Fix beta build
There is a workaround for emberjs/ember.js#19334 Revert this commit when the upstream bug is fixed.
1 parent c32aa34 commit cc75067

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

src/markdown/tutorial/part-1/08-working-with-data.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,21 +348,23 @@ The last change we'll need to make is to our `index.hbs` route template, where w
348348
349349
Let's see how.
350350

351+
<!-- Workaround for https://github.com/emberjs/ember.js/issues/19334 -->
352+
351353
```run:file:patch lang=handlebars cwd=super-rentals filename=app/templates/index.hbs
352354
@@ -8,5 +8,5 @@
353355
<ul class="results">
354356
- <li><Rental @rental={{@model}} /></li>
355357
- <li><Rental @rental={{@model}} /></li>
356358
- <li><Rental @rental={{@model}} /></li>
357-
+ {{#each @model as |rental|}}
358-
+ <li><Rental @rental={{rental}} /></li>
359+
+ {{#each @model as |property|}}
360+
+ <li><Rental @rental={{property}} /></li>
359361
+ {{/each}}
360362
</ul>
361363
```
362364

363365
We can use the `{{#each}}...{{/each}}` syntax to iterate and loop through the array returned by the model hook. For each iteration through the array&mdash;for each item in the array&mdash;we will render the block that is passed to it once. In our case, the block is our `<Rental>` component, surrounded by `<li>` tags.
364366

365-
Inside of the block we have access to the item of the *current* iteration with the `{{rental}}` variable. But why `rental`? Well, because we named it that! This variable comes from the `as |rental|` declaration of the `each` loop. We could have just as easily called it something else, like `as |property|`, in which case we would have to access the current item through the `{{property}}` variable.
367+
Inside of the block we have access to the item of the *current* iteration with the `{{property}}` variable. But why `property`? Well, because we named it that! This variable comes from the `as |property|` declaration of the `each` loop. We could have just as easily called it something else, like `as |rental|`, in which case we would have to access the current item through the `{{rental}}` variable.
366368

367369
Now, let's go over to our browser and see what our index route looks like with this change.
368370

src/markdown/tutorial/part-2/12-provider-components.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ Wait...why don't we just refactor the search box into a component? Once we do th
5858

5959
Let's start simple again and begin our refactor by creating a new template for our component, which we will call `rentals.hbs`.
6060

61+
<!-- Workaround for https://github.com/emberjs/ember.js/issues/19334 -->
62+
6163
```run:file:create lang=handlebars cwd=super-rentals filename=app/components/rentals.hbs
6264
<div class="rentals">
6365
<label>
@@ -66,8 +68,8 @@ Let's start simple again and begin our refactor by creating a new template for o
6668
</label>
6769
6870
<ul class="results">
69-
{{#each @rentals as |rental|}}
70-
<li><Rental @rental={{rental}} /></li>
71+
{{#each @rentals as |property|}}
72+
<li><Rental @rental={{property}} /></li>
7173
{{/each}}
7274
</ul>
7375
</div>
@@ -85,8 +87,8 @@ There is one minor change to note here: while extracting our markup into a compo
8587
- </label>
8688
-
8789
- <ul class="results">
88-
- {{#each @model as |rental|}}
89-
- <li><Rental @rental={{rental}} /></li>
90+
- {{#each @model as |property|}}
91+
- <li><Rental @rental={{property}} /></li>
9092
- {{/each}}
9193
- </ul>
9294
-</div>
@@ -283,12 +285,12 @@ Well, in order to answer this question, let's look at how the data that we're yi
283285
```run:file:patch lang=handlebars cwd=super-rentals filename=app/components/rentals.hbs
284286
@@ -7,5 +7,7 @@
285287
<ul class="results">
286-
- {{#each @rentals as |rental|}}
287-
- <li><Rental @rental={{rental}} /></li>
288+
- {{#each @rentals as |property|}}
289+
- <li><Rental @rental={{property}} /></li>
288290
- {{/each}}
289291
+ <Rentals::Filter @rentals={{@rentals}} @query={{this.query}} as |results|>
290-
+ {{#each results as |rental|}}
291-
+ <li><Rental @rental={{rental}} /></li>
292+
+ {{#each results as |property|}}
293+
+ <li><Rental @rental={{property}} /></li>
292294
+ {{/each}}
293295
+ </Rentals::Filter>
294296
</ul>

0 commit comments

Comments
 (0)