Skip to content

Commit

Permalink
Call props.onChange only when closing filter (apache#4003)
Browse files Browse the repository at this point in the history
  • Loading branch information
betodealmeida authored and michellethomas committed May 23, 2018
1 parent 4f166ca commit 72c05fa
Showing 1 changed file with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,6 @@ export default class DateFilterControl extends React.Component {
onNumberChange(event) {
this.setState({ num: event.target.value }, this.onChange);
}
onChange() {
let val;
if (this.state.type === 'rel') {
val = `${this.state.num} ${this.state.grain} ${this.state.rel}`;
} else if (this.state.type === 'fix') {
val = this.state.dttm;
} else if (this.state.type === 'free') {
val = this.state.free;
}
this.props.onChange(val);
}
onFreeChange(event) {
this.setState({ free: event.target.value }, this.onChange);
}
Expand All @@ -88,6 +77,15 @@ export default class DateFilterControl extends React.Component {
this.setState({ dttm: dttm.format().substring(0, 19) }, this.onChange);
}
close() {
let val;
if (this.state.type === 'rel') {
val = `${this.state.num} ${this.state.grain} ${this.state.rel}`;
} else if (this.state.type === 'fix') {
val = this.state.dttm;
} else if (this.state.type === 'free') {
val = this.state.free;
}
this.props.onChange(val);
this.refs.trigger.hide();
}
renderPopover() {
Expand Down

0 comments on commit 72c05fa

Please sign in to comment.