updateFilter

This commit is contained in:
Paul Sealock 2019-01-17 08:57:41 +13:00
parent 7b11e40981
commit 4cd803466a
2 changed files with 5 additions and 5 deletions

View File

@ -172,10 +172,10 @@ class DateFilter extends Component {
}
onRuleChange( value ) {
const { onFilterChange, filter, replaceFilter } = this.props;
const { onFilterChange, filter, updateFilter } = this.props;
const { before } = this.state;
if ( 'between' === filter.rule && 'between' !== value ) {
replaceFilter( {
updateFilter( {
key: filter.key,
rule: value,
value: before ? before.format( isoDateFormat ) : undefined,

View File

@ -55,7 +55,7 @@ class AdvancedFilters extends Component {
this.removeFilter = this.removeFilter.bind( this );
this.clearFilters = this.clearFilters.bind( this );
this.getUpdateHref = this.getUpdateHref.bind( this );
this.replaceFilter = this.replaceFilter.bind( this );
this.updateFilter = this.updateFilter.bind( this );
}
componentDidUpdate( prevProps ) {
@ -86,7 +86,7 @@ class AdvancedFilters extends Component {
this.setState( { activeFilters } );
}
replaceFilter( filter ) {
updateFilter( filter ) {
const activeFilters = this.state.activeFilters.map( activeFilter => {
if ( filter.key === activeFilter.key ) {
return filter;
@ -230,7 +230,7 @@ class AdvancedFilters extends Component {
onFilterChange={ this.onFilterChange }
isEnglish={ isEnglish }
query={ query }
replaceFilter={ this.replaceFilter }
updateFilter={ this.updateFilter }
/>
) }
<IconButton