Skip to content

Commit

Permalink
fix(react-grid): fix incorrect filter operation updating (#1270)
Browse files Browse the repository at this point in the history
fixes #1269
  • Loading branch information
kvet committed Jul 27, 2018
1 parent e40908e commit ed9fa16
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,18 @@ import { Overlay } from '../parts/overlay';
export class FilterSelector extends React.PureComponent {
constructor(props) {
super(props);
const getOpenedState = () => {
const { opened } = this.state;
return opened;
};
const { onChange } = this.props;

this.state = { opened: false };

this.handleButtonClick = () => {
this.setState({ opened: !getOpenedState() });
this.setState(prevState => ({ opened: !prevState.opened }));
};
this.handleOverlayHide = () => {
this.setState({ opened: false });
};
this.handleMenuItemClick = (nextValue) => {
this.setState({ opened: false });
const { onChange } = this.props;
onChange(nextValue);
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,18 @@ import classNames from 'classnames';
export class FilterSelector extends React.PureComponent {
constructor(props) {
super(props);
const getStateOpened = () => {
const { opened } = this.state;
return opened;
};
const { onChange } = this.props;

this.state = { opened: false };

this.handleButtonClick = () => {
this.setState({ opened: !getStateOpened() });
this.setState(prevState => ({ opened: !prevState.opened }));
};
this.handleOverlayToggle = () => {
if (getStateOpened()) this.setState({ opened: false });
const { opened } = this.state;
if (opened) this.setState({ opened: false });
};
this.handleMenuItemClick = (nextValue) => {
const { onChange } = this.props;
this.setState({ opened: false });
onChange(nextValue);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const styles = ({ spacing }) => ({
class FilterSelectorBase extends React.PureComponent {
constructor(props) {
super(props);
const { onChange } = this.props;

this.state = { anchorEl: null };

Expand All @@ -27,6 +26,7 @@ class FilterSelectorBase extends React.PureComponent {
this.setState({ anchorEl: null });
};
this.handleMenuItemClick = (nextValue) => {
const { onChange } = this.props;
this.setState({ anchorEl: null });
onChange(nextValue);
};
Expand Down

0 comments on commit ed9fa16

Please sign in to comment.