mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 09:17:30 +08:00
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
|
@ -127,16 +127,9 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
|||
this.updatePosition(true);
|
||||
},
|
||||
|
||||
debounceLoadSuggested: Discourse.debounce(function(lookup){
|
||||
var suggested = this.get('topic.suggested_topics');
|
||||
debounceLoadSuggested: Discourse.debounce(function(){
|
||||
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 suggested = this.get('topic.suggested_topics');
|
||||
var topicId = this.get('topic.id');
|
||||
|
@ -154,9 +147,15 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
|||
.first(5)
|
||||
.value();
|
||||
|
||||
|
||||
this.debounceLoadSuggested(lookup);
|
||||
Discourse.TopicList.loadTopics(lookup, "").then(function(topics){
|
||||
suggested.clear();
|
||||
suggested.pushObjects(topics);
|
||||
});
|
||||
}
|
||||
}, 1000),
|
||||
|
||||
hasNewSuggested: function(){
|
||||
this.debounceLoadSuggested();
|
||||
}.observes('topicTrackingState.incomingCount'),
|
||||
|
||||
// Triggered whenever any posts are rendered, debounced to save over calling
|
||||
|
|
Loading…
Reference in New Issue
Block a user