diff --git a/examples/todos/client/templates/lists-show.html b/examples/todos/client/templates/lists-show.html
index 50e0ee0ce6..7b5efcd25e 100644
--- a/examples/todos/client/templates/lists-show.html
+++ b/examples/todos/client/templates/lists-show.html
@@ -53,14 +53,18 @@
{{#if todosReady}}
- {{#each todos}}
- {{> todosItem}}
- {{else}}
-
-
No tasks here
-
Add new tasks using the field above
-
- {{/each}}
+ {{#with _id}} {{! Establish new data context with only the '_id'
+ field. This way, when the 'incompleteCount' field
+ changes, we don't re-render the list contents }}
+ {{#each todos this}}
+ {{> todosItem}}
+ {{else}}
+
+
No tasks here
+
Add new tasks using the field above
+
+ {{/each}}
+ {{/with}}
{{else}}
Loading tasks...
@@ -68,4 +72,4 @@
{{/if}}
-
\ No newline at end of file
+
diff --git a/examples/todos/client/templates/lists-show.js b/examples/todos/client/templates/lists-show.js
index 483709d350..65eeb55fe2 100644
--- a/examples/todos/client/templates/lists-show.js
+++ b/examples/todos/client/templates/lists-show.js
@@ -26,8 +26,8 @@ Template.listsShow.helpers({
return Router.current().todosHandle.ready();
},
- todos: function() {
- return Todos.find({listId: this._id}, {sort: {createdAt : -1}});
+ todos: function(listId) {
+ return Todos.find({listId: listId}, {sort: {createdAt : -1}});
}
});
@@ -157,4 +157,4 @@ Template.listsShow.events({
Lists.update(this._id, {$inc: {incompleteCount: 1}});
$input.val('');
}
-});
\ No newline at end of file
+});