From 32b52642ab38e3301ca783ba035974e475dd6aaf Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 11 Dec 2014 16:21:39 +1100 Subject: [PATCH] PERF: don't render composer until we need it --- .../javascripts/discourse/controllers/composer.js.es6 | 7 ++++++- app/assets/javascripts/discourse/templates/composer.hbs | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/controllers/composer.js.es6 b/app/assets/javascripts/discourse/controllers/composer.js.es6 index c75936912..c15d158ad 100644 --- a/app/assets/javascripts/discourse/controllers/composer.js.es6 +++ b/app/assets/javascripts/discourse/controllers/composer.js.es6 @@ -465,6 +465,11 @@ export default DiscourseController.extend({ canEdit: function() { return this.get("model.action") === "edit" && Discourse.User.current().get("can_edit"); - }.property("model.action") + }.property("model.action"), + + visible: function() { + var state = this.get('model.composeState'); + return state && state !== 'closed'; + }.property('model.composeState') }); diff --git a/app/assets/javascripts/discourse/templates/composer.hbs b/app/assets/javascripts/discourse/templates/composer.hbs index db31e4adf..9d068ec8d 100644 --- a/app/assets/javascripts/discourse/templates/composer.hbs +++ b/app/assets/javascripts/discourse/templates/composer.hbs @@ -1,3 +1,4 @@ +{{#if visible}}
{{loading-spinner}}
@@ -116,3 +117,4 @@ +{{/if}}