Clear advanced filters when last one is removed
This commit is contained in:
parent
7423726786
commit
3474a26cb5
|
@ -19,6 +19,7 @@ import {
|
||||||
getDefaultOptionValue,
|
getDefaultOptionValue,
|
||||||
getNewPath,
|
getNewPath,
|
||||||
getQueryFromActiveFilters,
|
getQueryFromActiveFilters,
|
||||||
|
getHistory,
|
||||||
} from '@woocommerce/navigation';
|
} from '@woocommerce/navigation';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -103,6 +104,10 @@ class AdvancedFilters extends Component {
|
||||||
const index = findIndex( activeFilters, filter => filter.key === key );
|
const index = findIndex( activeFilters, filter => filter.key === key );
|
||||||
activeFilters.splice( index, 1 );
|
activeFilters.splice( index, 1 );
|
||||||
this.setState( { activeFilters } );
|
this.setState( { activeFilters } );
|
||||||
|
if ( 0 === activeFilters.length ) {
|
||||||
|
const history = getHistory();
|
||||||
|
history.push( this.getUpdateHref( [] ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getTitle() {
|
getTitle() {
|
||||||
|
|
Loading…
Reference in New Issue