Clear features filter on reset all

Also add enableReinitialize and keepDirtyOnReinitialize props to the
form to enable filter clear without a destroy call to the form.
This commit is contained in:
Hannu Lyytikainen 2018-02-08 15:44:03 +02:00
parent a176df4154
commit 7bafc7e071
3 changed files with 4 additions and 6 deletions

View file

@ -100,7 +100,7 @@ class SearchFiltersMobileComponent extends Component {
resetAll(e) {
const { urlQueryParams, history } = this.props;
const queryParams = omit(urlQueryParams, CATEGORY_URL_PARAM);
const queryParams = omit(urlQueryParams, [CATEGORY_URL_PARAM, FEATURES_URL_PARAM]);
history.push(createResourceLocatorString('SearchPage', routeConfiguration(), {}, queryParams));
// blur event target if event is passed

View file

@ -43,6 +43,8 @@ const SelectMultipleFilterMobile = props => {
initialValuesCount={initialValues.length}
onChange={handleSelect}
onClear={handleClear}
enableReinitialize={true}
keepDirtyOnReinitialize={true}
/>
</div>
);

View file

@ -17,11 +17,7 @@ class SelectMultipleFilterMobileFormComponent extends Component {
}
handleClear() {
const { destroy, onClear } = this.props;
// destroy redux form state so that initial values passed
// to the form are also cleared
destroy();
onClear();
this.props.onClear();
}
toggleIsOpen() {