correct suggested list trigger to perform all work AFTER it is debounced, avoids incorrect new/unread items
This commit is contained in:
parent
e603c85fa0
commit
fe979b7299
1 changed files with 10 additions and 11 deletions
|
@ -127,16 +127,9 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
||||||
this.updatePosition(true);
|
this.updatePosition(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
debounceLoadSuggested: Discourse.debounce(function(lookup){
|
debounceLoadSuggested: Discourse.debounce(function(){
|
||||||
var suggested = this.get('topic.suggested_topics');
|
if (this.get('isDestroyed') || this.get('isDestroying')) { return; }
|
||||||
|
|
||||||
Discourse.TopicList.loadTopics(lookup, "").then(function(topics){
|
|
||||||
suggested.clear();
|
|
||||||
suggested.pushObjects(topics);
|
|
||||||
});
|
|
||||||
}, 1000),
|
|
||||||
|
|
||||||
hasNewSuggested: function(){
|
|
||||||
var incoming = this.get('topicTrackingState.newIncoming');
|
var incoming = this.get('topicTrackingState.newIncoming');
|
||||||
var suggested = this.get('topic.suggested_topics');
|
var suggested = this.get('topic.suggested_topics');
|
||||||
var topicId = this.get('topic.id');
|
var topicId = this.get('topic.id');
|
||||||
|
@ -154,9 +147,15 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
||||||
.first(5)
|
.first(5)
|
||||||
.value();
|
.value();
|
||||||
|
|
||||||
|
Discourse.TopicList.loadTopics(lookup, "").then(function(topics){
|
||||||
this.debounceLoadSuggested(lookup);
|
suggested.clear();
|
||||||
|
suggested.pushObjects(topics);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
}, 1000),
|
||||||
|
|
||||||
|
hasNewSuggested: function(){
|
||||||
|
this.debounceLoadSuggested();
|
||||||
}.observes('topicTrackingState.incomingCount'),
|
}.observes('topicTrackingState.incomingCount'),
|
||||||
|
|
||||||
// Triggered whenever any posts are rendered, debounced to save over calling
|
// Triggered whenever any posts are rendered, debounced to save over calling
|
||||||
|
|
Reference in a new issue