PERF: Do far fewer checks and use a lot less memory when loading more

This commit is contained in:
Robin Ward 2014-08-27 15:31:06 -04:00
parent 965ff51efe
commit f05d2ed7cf
3 changed files with 7 additions and 8 deletions

View file

@ -15,9 +15,8 @@ Discourse.LoadMore = Em.Mixin.create(Ember.ViewTargetActionSupport, Discourse.Sc
if (eyeline) { eyeline.update(); }
},
didInsertElement: function() {
this._super();
var eyeline = new Discourse.Eyeline(this.get('eyelineSelector'));
_bindEyeline: function() {
var eyeline = new Discourse.Eyeline(this.get('eyelineSelector') + ":last");
this.set('eyeline', eyeline);
var self = this;
@ -25,11 +24,10 @@ Discourse.LoadMore = Em.Mixin.create(Ember.ViewTargetActionSupport, Discourse.Sc
self.send('loadMore');
});
this.bindScrolling();
},
}.on('didInsertElement'),
willDestroyElement: function() {
this._super();
_removeEyeline: function() {
this.unbindScrolling();
}
}.on('willDestroyElement')
});

View file

@ -193,7 +193,7 @@ Discourse.UserAction = Discourse.Model.extend({
Discourse.UserAction.reopenClass({
collapseStream: function(stream) {
var uniq = {},
collapsed = Em.A(),
collapsed = [],
pos = 0;
stream.forEach(function(item) {

View file

@ -14,6 +14,7 @@ export default Ember.View.extend(Discourse.LoadMore, {
var self = this;
if (this.get('loading')) { return; }
this.set('loading', true);
var stream = this.get('controller.model');
stream.findItems().then(function() {
self.set('loading', false);