0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-26 00:52:48 +00:00

Debounce validation on Lang field

This commit is contained in:
Trevor Buckner
2023-03-20 13:17:51 -04:00
parent cf99bd9004
commit 0a7ccfb89e
2 changed files with 5 additions and 2 deletions

View File

@@ -126,4 +126,4 @@ const Combobox = createClass({
}
});
module.exports = Combobox;
module.exports = Combobox;

View File

@@ -245,6 +245,7 @@ const MetadataEditor = createClass({
});
};
const debouncedHandleFieldChange = _.debounce(this.handleFieldChange, 500);
return <div className='field language'>
<label>language</label>
@@ -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',