From 196ac20669c1bea44e64ac9efff49d3bbd23a46d Mon Sep 17 00:00:00 2001 From: rhymes Date: Wed, 4 Mar 2020 17:41:12 +0100 Subject: [PATCH] Fix tags autocomplete deleting input with fast typing (#6448) [deploy] --- app/javascript/shared/components/tags.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/javascript/shared/components/tags.jsx b/app/javascript/shared/components/tags.jsx index f7db730ed..afeaf439a 100644 --- a/app/javascript/shared/components/tags.jsx +++ b/app/javascript/shared/components/tags.jsx @@ -31,9 +31,10 @@ class Tags extends Component { constructor(props) { super(props); - this.debouncedTagSearch = debounce(this.handleInput.bind(this), 150, { - leading: true, - }); + // 250ms without invoking the function at the leading edge of the timeout + // NOTE: this seems the best combination of wait time and options to avoid + // flickering and text replacement during autocomplete + this.debouncedTagSearch = debounce(this.handleInput.bind(this), 250); this.state = { selectedIndex: -1,