Commit f4495922 authored by Elie NEHME's avatar Elie NEHME

Debounce the rendering of the application view

If we don't debounce "this.render", the app-view will be rendered 4 times on each todo (visible, change, change:complete and sync). So when we try to check globally all todos, this.render is called a hundred times. Once this PR is accepted, I will edit Backbone-requirejs.
parent 65a8ecfa
......@@ -41,7 +41,7 @@ define([
this.listenTo(Todos, 'reset', this.addAll);
this.listenTo(Todos, 'change:completed', this.filterOne);
this.listenTo(Todos, 'filter', this.filterAll);
this.listenTo(Todos, 'all', this.render);
this.listenTo(Todos, 'all', _.debounce(this.render, 0));
Todos.fetch({reset:true});
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment