From 224c8ee3551903e18b7e981fabb0f9f288cd7c63 Mon Sep 17 00:00:00 2001 From: Roman Rizzi Date: Tue, 22 Dec 2020 14:34:31 -0300 Subject: [PATCH] DEV: Use the new discourseDebounce function wrapper. (#85) 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. --- .../controllers/discourse-post-event-invitees.js.es6 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/assets/javascripts/discourse/controllers/discourse-post-event-invitees.js.es6 b/assets/javascripts/discourse/controllers/discourse-post-event-invitees.js.es6 index 751e5932..bbc81c65 100644 --- a/assets/javascripts/discourse/controllers/discourse-post-event-invitees.js.es6 +++ b/assets/javascripts/discourse/controllers/discourse-post-event-invitees.js.es6 @@ -1,7 +1,8 @@ import ModalFunctionality from "discourse/mixins/modal-functionality"; import Controller from "@ember/controller"; -import { debounce } from "@ember/runloop"; import { action } from "@ember/object"; +import discourseDebounce from "discourse-common/lib/debounce"; +import { debounce } from "@ember/runloop"; export default Controller.extend(ModalFunctionality, { invitees: null, @@ -14,7 +15,10 @@ export default Controller.extend(ModalFunctionality, { @action onFilterChanged(filter) { - debounce(this, this._fetchInvitees, filter, 250); + // TODO: Use discouseDebounce after the 2.7 release. + const debounceFunc = discourseDebounce || debounce; + + debounceFunc(this, this._fetchInvitees, filter, 250); }, @action