mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-07 14:12:43 +00:00
Debounce validation on Lang field
This commit is contained in:
@@ -126,4 +126,4 @@ const Combobox = createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = Combobox;
|
module.exports = Combobox;
|
||||||
|
|||||||
@@ -245,6 +245,7 @@ const MetadataEditor = createClass({
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const debouncedHandleFieldChange = _.debounce(this.handleFieldChange, 500);
|
||||||
|
|
||||||
return <div className='field language'>
|
return <div className='field language'>
|
||||||
<label>language</label>
|
<label>language</label>
|
||||||
@@ -254,7 +255,9 @@ const MetadataEditor = createClass({
|
|||||||
default={this.props.metadata.lang || ''}
|
default={this.props.metadata.lang || ''}
|
||||||
placeholder='en'
|
placeholder='en'
|
||||||
onSelect={(value)=>this.handleLanguage(value)}
|
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()}
|
options={listLanguages()}
|
||||||
autoSuggest={{
|
autoSuggest={{
|
||||||
suggestMethod : 'startsWith',
|
suggestMethod : 'startsWith',
|
||||||
|
|||||||
Reference in New Issue
Block a user