Revert "Revert "DEV: Wrap Ember.run.debounce. (#11352)"" (#11509)

* Revert "Revert "DEV: Wrap `Ember.run.debounce`. (#11352)" (#11465)"

This reverts commit aa0d4ea764.

* Correctly debounce onScroll function
This commit is contained in:
Roman Rizzi
2020-12-18 10:18:52 -03:00
committed by GitHub
parent f296ca4b4a
commit 142e0ae062
51 changed files with 526 additions and 358 deletions

View File

@@ -2,7 +2,7 @@ import Controller from "@ember/controller";
import I18n from "I18n";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { alias } from "@ember/object/computed";
import discourseDebounce from "discourse/lib/debounce";
import discourseDebounce from "discourse-common/lib/debounce";
import { isEmpty } from "@ember/utils";
import { observes } from "discourse-common/utils/decorators";
@@ -112,13 +112,19 @@ export default Controller.extend({
},
@observes("filter", "onlyOverridden", "model")
filterContent: discourseDebounce(function () {
if (this._skipBounce) {
this.set("_skipBounce", false);
} else {
this.filterContentNow(this.categoryNameKey);
}
}, INPUT_DELAY),
filterContent() {
discourseDebounce(
this,
() => {
if (this._skipBounce) {
this.set("_skipBounce", false);
} else {
this.filterContentNow(this.categoryNameKey);
}
},
INPUT_DELAY
);
},
actions: {
clearFilter() {