PERF: Do far fewer checks and use a lot less memory when loading more
This commit is contained in:
parent
965ff51efe
commit
f05d2ed7cf
|
@ -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')
|
||||
|
||||
});
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue