FIX: Use Ember's debounce on stable. (#96)

We need to wrap the new debounce function inside a try block to avoid throwing a "module not found" exception.
This commit is contained in:
Roman Rizzi 2021-02-22 12:55:11 -03:00 committed by GitHub
parent 4f33c22344
commit 50e62d84e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -2,8 +2,7 @@ import {
default as computed, default as computed,
observes, observes,
} from "discourse-common/utils/decorators"; } from "discourse-common/utils/decorators";
import discourseDebounce from "discourse-common/lib/debounce"; import { debounce } from "@ember/runloop";
import debounce from "@ember/runloop";
export default Ember.Component.extend({ export default Ember.Component.extend({
actions: { actions: {
@ -116,7 +115,11 @@ export default Ember.Component.extend({
@observes("filter") @observes("filter")
triggerFilter() { triggerFilter() {
// TODO: Use discouseDebounce after the 2.7 release. // TODO: Use discouseDebounce after the 2.7 release.
let debounceFunc = discourseDebounce || debounce; let debounceFunc = debounce;
try {
debounceFunc = require("discourse-common/lib/debounce").default;
} catch (_) {}
debounceFunc( debounceFunc(
this, this,