From 78dad97dc86c9bc3db8479dde4ab830c0784b167 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Mon, 4 Jan 2021 14:22:43 +0800 Subject: [PATCH] Use ember debounce until discourseDebounce hits stable --- assets/javascripts/wizard-custom.js | 1 - assets/javascripts/wizard/lib/user-search.js.es6 | 8 +++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/assets/javascripts/wizard-custom.js b/assets/javascripts/wizard-custom.js index 4c6561c6..5d18328f 100644 --- a/assets/javascripts/wizard-custom.js +++ b/assets/javascripts/wizard-custom.js @@ -84,7 +84,6 @@ //= require discourse-common/addon/helpers/component-for-collection //= require discourse-common/addon/helpers/component-for-row //= require discourse-common/addon/lib/raw-templates -//= require discourse-common/lib/debounce //= require discourse/app/helpers/discourse-tag //= require discourse/app/services/app-events diff --git a/assets/javascripts/wizard/lib/user-search.js.es6 b/assets/javascripts/wizard/lib/user-search.js.es6 index 55b6b069..5a86d8d8 100644 --- a/assets/javascripts/wizard/lib/user-search.js.es6 +++ b/assets/javascripts/wizard/lib/user-search.js.es6 @@ -1,6 +1,5 @@ import { CANCELLED_STATUS } from 'discourse/lib/autocomplete'; import { debounce } from "@ember/runloop"; -import discourseDebounce from "discourse-common/lib/debounce"; import getUrl from 'discourse-common/lib/get-url'; var cache = {}, @@ -118,10 +117,8 @@ export default function userSearch(options) { resolve(CANCELLED_STATUS); }, 5000); - // TODO: Use discouseDebounce after the 2.7 release. - let debounceFunc = discourseDebounce || debounce; - - debounceFunc( + // TODO: Use discouseDebounce after it is available on stable. + debounce( this, function() { performSearch( @@ -140,4 +137,5 @@ export default function userSearch(options) { }, 300 ) + }); }