Use the new discourseDebounce function wrapper. (#124)

We recently merged a Discourse core's PR to replace usages of Ember's debounce and discourseDebounce with a new debounce wrapper. The new wrapper works exactly like Ember's debounce but internally calls "run" when called in test mode.

This PR replaces all usages of other debounce functions with the new wrapper and fallbacks to Ember's debounce for backward-compatibility.
This commit is contained in:
Roman Rizzi 2020-12-22 14:34:03 -03:00 committed by GitHub
parent 60ef0c8f41
commit 1663b3ab18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 3 deletions

View File

@ -1,7 +1,7 @@
import UserTopicsList from "discourse/controllers/user-topics-list";
import { alias } from "@ember/object/computed";
import { debounce } from "@ember/runloop";
import discourseComputed from "discourse-common/utils/decorators";
import debounce from "discourse/plugins/discourse-assign/lib/debounce";
import { INPUT_DELAY } from "discourse-common/config/environment";
export default UserTopicsList.extend({

View File

@ -1,9 +1,9 @@
import { inject as service } from "@ember/service";
import Controller, { inject as controller } from "@ember/controller";
import { action } from "@ember/object";
import { debounce } from "@ember/runloop";
import { ajax } from "discourse/lib/ajax";
import discourseComputed from "discourse-common/utils/decorators";
import debounce from "discourse/plugins/discourse-assign/lib/debounce";
import { INPUT_DELAY } from "discourse-common/config/environment";
export default Controller.extend({

View File

@ -1,6 +1,6 @@
import UserTopicsList from "discourse/controllers/user-topics-list";
import { debounce } from "@ember/runloop";
import discourseComputed from "discourse-common/utils/decorators";
import debounce from "discourse/plugins/discourse-assign/lib/debounce";
import { INPUT_DELAY } from "discourse-common/config/environment";
export default UserTopicsList.extend({

View File

@ -0,0 +1,6 @@
import discourseDebounce from "discourse-common/lib/debounce";
import { debounce } from "@ember/runloop";
// TODO: Remove this file and use discouseDebounce after the 2.7 release.
const debounceFunction = discourseDebounce || debounce;
export default debounceFunction;