PERF: reduces cpu/memory consumption of sk in some cases (#7525)

PERF: reduces cpu/memory consumption of sk in some cases (#7525)

diff --git a/app/assets/javascripts/select-kit/components/combo-box.js.es6 b/app/assets/javascripts/select-kit/components/combo-box.js.es6
index 944a64e..65cf8b8 100644
--- a/app/assets/javascripts/select-kit/components/combo-box.js.es6
+++ b/app/assets/javascripts/select-kit/components/combo-box.js.es6
@@ -25,7 +25,7 @@ export default SingleSelectComponent.extend({
     return isExpanded ? caretUpIcon : caretDownIcon;
   },
 
-  @on("didReceiveAttrs")
+  @on("didUpdateAttrs", "init")
   _setComboBoxOptions() {
     this.get("headerComponentOptions").setProperties({
       clearable: this.get("clearable")
diff --git a/app/assets/javascripts/select-kit/components/dropdown-select-box.js.es6 b/app/assets/javascripts/select-kit/components/dropdown-select-box.js.es6
index d510c2f..773710c 100644
--- a/app/assets/javascripts/select-kit/components/dropdown-select-box.js.es6
+++ b/app/assets/javascripts/select-kit/components/dropdown-select-box.js.es6
@@ -13,7 +13,7 @@ export default SingleSelectComponent.extend({
   showFullTitle: true,
   allowInitialValueMutation: false,
 
-  @on("didReceiveAttrs")
+  @on("didUpdateAttrs", "init")
   _setDropdownSelectBoxComponentOptions() {
     this.get("headerComponentOptions").setProperties({
       showFullTitle: this.get("showFullTitle")
diff --git a/app/assets/javascripts/select-kit/components/multi-select.js.es6 b/app/assets/javascripts/select-kit/components/multi-select.js.es6
index 3898288..d380c34 100644
--- a/app/assets/javascripts/select-kit/components/multi-select.js.es6
+++ b/app/assets/javascripts/select-kit/components/multi-select.js.es6
@@ -44,7 +44,7 @@ export default SelectKitComponent.extend({
     }
   },
 
-  @on("didReceiveAttrs")
+  @on("didUpdateAttrs", "init")
   _compute() {
     run.scheduleOnce("afterRender", () => {
       this.willComputeAttributes();
diff --git a/app/assets/javascripts/select-kit/components/period-chooser.js.es6 b/app/assets/javascripts/select-kit/components/period-chooser.js.es6
index fe784b5..74dd2d8 100644
--- a/app/assets/javascripts/select-kit/components/period-chooser.js.es6
+++ b/app/assets/javascripts/select-kit/components/period-chooser.js.es6
@@ -14,7 +14,7 @@ export default DropdownSelectBoxComponent.extend({
     return isExpanded ? "caret-up" : "caret-down";
   },
 
-  @on("didReceiveAttrs")
+  @on("didUpdateAttrs", "init")
   _setFullDay() {
     this.get("headerComponentOptions").setProperties({
       fullDay: this.get("fullDay")
diff --git a/app/assets/javascripts/select-kit/components/select-kit/select-kit-row.js.es6 b/app/assets/javascripts/select-kit/components/select-kit/select-kit-row.js.es6
index 58ac234..6cac142 100644
--- a/app/assets/javascripts/select-kit/components/select-kit/select-kit-row.js.es6
+++ b/app/assets/javascripts/select-kit/components/select-kit/select-kit-row.js.es6
@@ -52,11 +52,10 @@ export default Ember.Component.extend(UtilsMixin, {
 
   @on("didReceiveAttrs")
   _setSelectionState() {
-    this.set("isSelected", this.get("computedValue") === this.get("value"));
-    this.set(
-      "isHighlighted",
-      this.get("highlighted.value") === this.get("value")
-    );
+    this.setProperties({
+      isSelected: this.get("computedValue") === this.get("value"),
+      isHighlighted: this.get("highlighted.value") === this.get("value")
+    });
   },
 
   @on("willDestroyElement")
diff --git a/app/assets/javascripts/select-kit/components/single-select.js.es6 b/app/assets/javascripts/select-kit/components/single-select.js.es6
index aede1d9..5ddf7cd 100644
--- a/app/assets/javascripts/select-kit/components/single-select.js.es6
+++ b/app/assets/javascripts/select-kit/components/single-select.js.es6
@@ -18,7 +18,7 @@ export default SelectKitComponent.extend({
   value: null,
   allowInitialValueMutation: false,
 
-  @on("didReceiveAttrs")
+  @on("didUpdateAttrs", "init")
   _compute() {
     run.scheduleOnce("afterRender", () => {
       this.willComputeAttributes();

GitHub sha: c093fa03

1 Like