Skip to content

Commit

Permalink
Merge pull request #3671 from VictorRomanov1986/features/applied-filt…
Browse files Browse the repository at this point in the history
…ers-query-string

Do not clear query string if there are applied filters
  • Loading branch information
wobba authored Apr 10, 2024
2 parents 5f338a1 + 810a866 commit 29e99eb
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export default class SearchFiltersContainer extends React.Component<ISearchFilte

// When new filters are received from the data source
if (!isEqual(prevProps.availableFilters, this.props.availableFilters)
|| (!isEqual(prevState.currentUiFilters, this.state.currentUiFilters)) && prevState.currentUiFilters.length > 0) {
|| (!isEqual(prevState.currentUiFilters, this.state.currentUiFilters)) && prevState.currentUiFilters.length > 0) {

this.getFiltersDeepLink();
this.getFiltersToDisplay(this.props.availableFilters, this.state.currentUiFilters, this.props.filtersConfiguration);
Expand Down Expand Up @@ -525,7 +525,15 @@ export default class SearchFiltersContainer extends React.Component<ISearchFilte
// Refresh the UI
this.getFiltersToDisplay(this.props.availableFilters, updatedfilters, this.props.filtersConfiguration);

this.resetFiltersDeepLink();
// Check whether there are applied filters
const appliedFilters = updateSubmittedFilters.filter(filter => filter.values.length > 0);
if (appliedFilters.length == 0) {
// If no - remove query string
this.resetFiltersDeepLink();
} else {
// If yes - update query string
this.setFiltersDeepLink(updateSubmittedFilters);
}

// Send selected filters to the data source
this.props.onUpdateFilters(updateSubmittedFilters);
Expand Down

0 comments on commit 29e99eb

Please sign in to comment.