DEV: Update properties inside an Ember RunLoop.

DEV: Update properties inside an Ember RunLoop.

From 4e3a4e72b1fbf6d0e0fd58c1cddbc64d3d040807 Mon Sep 17 00:00:00 2001
From: Dan Ungureanu <dan@ungureanu.me>
Date: Fri, 30 Nov 2018 23:02:10 +0200
Subject: [PATCH] DEV: Update properties inside an Ember RunLoop.


diff --git a/assets/javascripts/lib/discourse.js.es6 b/assets/javascripts/lib/discourse.js.es6
index 28196ab..bb576f1 100644
--- a/assets/javascripts/lib/discourse.js.es6
+++ b/assets/javascripts/lib/discourse.js.es6
@@ -197,8 +197,12 @@ export function getEncryptionStatus() {
 export function hideComponentIfDisabled(component) {
   let handler = () => {
     getEncryptionStatus().then(newStatus => {
-      component.set("isEncryptEnabled", newStatus === ENCRYPT_ENABLED);
-      component.set("isEncryptActive", newStatus === ENCRYPT_ACTIVE);
+      Ember.run(() =>
+        component.setProperties({
+          isEncryptEnabled: newStatus === ENCRYPT_ENABLED,
+          isEncryptActive: newStatus === ENCRYPT_ACTIVE
+        })
+      );
     });
   };

GitHub

2 Likes