PERF: hold back rendering of suggested topics 1 run loop.

This commit is contained in:
Sam 2014-12-22 13:18:19 +11:00
parent b279b1daa0
commit 27d43ad6c0
2 changed files with 15 additions and 1 deletions

View File

@ -41,6 +41,20 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, {
}.observes('controllers.search.term', 'controllers.header.visibleDropdown'), }.observes('controllers.search.term', 'controllers.header.visibleDropdown'),
postStreamLoadedAllPostsChanged: function(){
// hold back rendering 1 run loop for every transition.
var self = this;
var loaded = this.get('postStream.loadedAllPosts');
this.set('loadedAllPosts', false);
if(loaded){
Em.run.next(function(){
self.set('loadedAllPosts',true);
});
}
}.observes('postStream', 'postStream.loadedAllPosts'),
show_deleted: function(key, value) { show_deleted: function(key, value) {
var postStream = this.get('postStream'); var postStream = this.get('postStream');
if (!postStream) { return; } if (!postStream) { return; }

View File

@ -90,7 +90,7 @@
<div id='topic-bottom'></div> <div id='topic-bottom'></div>
{{#loading-spinner condition=postStream.loadingFilter}} {{#loading-spinner condition=postStream.loadingFilter}}
{{#if postStream.loadedAllPosts}} {{#if loadedAllPosts}}
{{view 'topic-closing' topic=model}} {{view 'topic-closing' topic=model}}
{{view 'topic-footer-buttons' topic=model}} {{view 'topic-footer-buttons' topic=model}}