FIX: Debounce title decryption.

FIX: Debounce title decryption.

It used to be debounced and scheduled after each component decryption, which caused lag due to Ember’s runloop limitation (especially visible when typing fast into composer).

diff --git a/assets/javascripts/discourse/initializers/hook-decrypt-topic.js.es6 b/assets/javascripts/discourse/initializers/hook-decrypt-topic.js.es6
index 78408b6..1a463d3 100644
--- a/assets/javascripts/discourse/initializers/hook-decrypt-topic.js.es6
+++ b/assets/javascripts/discourse/initializers/hook-decrypt-topic.js.es6
@@ -71,10 +71,8 @@ export default {
     var self = this;
     Ember.Component.reopen({
       didRender() {
-        Ember.run.scheduleOnce("afterRender", this, () => {
-          Ember.run.debounce(self, decryptTitles, 250);
-        });
-        return this._super();
+        Ember.run.debounce(self, decryptTitles, 500);
+        return this._super(...arguments);
       }
     });
   }

GitHub sha: 3830eb32

1 Like