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

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:16 -03:00 committed by GitHub
parent b1b8c94f56
commit 394f857096
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,10 @@
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;
let debounceFunction = debounce;
try {
debounceFunction = require("discourse-common/lib/debounce").default;
} catch (_) {}
export default debounceFunction;