From 0a7ccfb89e5f44653276995d39ded0614c77eb81 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Mon, 20 Mar 2023 13:17:51 -0400 Subject: [PATCH] Debounce validation on Lang field --- client/components/combobox.jsx | 2 +- client/homebrew/editor/metadataEditor/metadataEditor.jsx | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/client/components/combobox.jsx b/client/components/combobox.jsx index 8963bcf68..a6e699dcf 100644 --- a/client/components/combobox.jsx +++ b/client/components/combobox.jsx @@ -126,4 +126,4 @@ const Combobox = createClass({ } }); -module.exports = Combobox; \ No newline at end of file +module.exports = Combobox; diff --git a/client/homebrew/editor/metadataEditor/metadataEditor.jsx b/client/homebrew/editor/metadataEditor/metadataEditor.jsx index 7f7cdbe6d..2d51a7b29 100644 --- a/client/homebrew/editor/metadataEditor/metadataEditor.jsx +++ b/client/homebrew/editor/metadataEditor/metadataEditor.jsx @@ -245,6 +245,7 @@ const MetadataEditor = createClass({ }); }; + const debouncedHandleFieldChange = _.debounce(this.handleFieldChange, 500); return
@@ -254,7 +255,9 @@ const MetadataEditor = createClass({ default={this.props.metadata.lang || ''} placeholder='en' onSelect={(value)=>this.handleLanguage(value)} - onEntry={(e)=>{this.handleFieldChange('lang', e);}} + onEntry={(e)=> { e.target.setCustomValidity(''); //Clear the validation popup while typing + debouncedHandleFieldChange('lang', e); + }} options={listLanguages()} autoSuggest={{ suggestMethod : 'startsWith',