Use defaultProps to set up the taxonomy control operators (https://github.com/woocommerce/woocommerce-blocks/pull/381)

This commit is contained in:
Kelly Dwan 2019-01-31 15:43:55 -05:00 committed by GitHub
parent ac96484f7a
commit 5f4b6c74db
2 changed files with 10 additions and 2 deletions

View File

@ -90,7 +90,7 @@ class ProductAttributeControl extends Component {
render() {
const { list, loading } = this.state;
const { onChange, onOperatorChange, operator = 'any', selected } = this.props;
const { onChange, onOperatorChange, operator, selected } = this.props;
const messages = {
clear: __( 'Clear all product attributes', 'woo-gutenberg-products-block' ),
@ -176,4 +176,8 @@ ProductAttributeControl.propTypes = {
selected: PropTypes.array.isRequired,
};
ProductAttributeControl.defaultProps = {
operator: 'any',
};
export default ProductAttributeControl;

View File

@ -75,7 +75,7 @@ class ProductCategoryControl extends Component {
render() {
const { list, loading } = this.state;
const { onChange, onOperatorChange, operator = 'any', selected } = this.props;
const { onChange, onOperatorChange, operator, selected } = this.props;
const messages = {
clear: __( 'Clear all product categories', 'woo-gutenberg-products-block' ),
@ -161,4 +161,8 @@ ProductCategoryControl.propTypes = {
selected: PropTypes.array.isRequired,
};
ProductCategoryControl.defaultProps = {
operator: 'any',
};
export default ProductCategoryControl;