Commit 82b10bbc by Vladislav Lagunov

Исправлена ошибка в Debounce

parent e2ed0fac
......@@ -47,7 +47,7 @@ export type State<A> = AutoCompleteState<A> & {
// Component
// @ts-ignore Хак для работы дженерик-параметров
@withStyles(styles)
export default class AutoComplete<A=string> extends React.Component<Props<A>, State<A>> {
export default class AutoComplete<A=string> extends React.PureComponent<Props<A>, State<A>> {
static defaultProps = {
openOnFocus: true,
openOnClick: true,
......
......@@ -24,7 +24,7 @@ export class Debounce<A> extends React.Component<Props<A>, State<A>> {
callback: Function|null = null;
componentWillReceiveProps(nextProps: Props<A>) {
if ('value' in this.state) this.setState(prev => ({}));
if ('value' in this.state) this.setState(prev => ({ value: undefined }));
}
handleChange = (value) => {
......@@ -48,7 +48,7 @@ export class Debounce<A> extends React.Component<Props<A>, State<A>> {
render() {
return React.cloneElement(this.props.children, {
value: 'value' in this.state ? this.state.value : this.props.children.props.value,
value: this.state.value !== undefined ? this.state.value : this.props.children.props.value,
onValueChange: this.handleChange,
onBlur: this.handleBlur,
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment