Fix error in searchbox in tickets/search-tickets (#891)

This commit is contained in:
LautaroCesso 2020-10-02 02:17:22 -03:00 committed by GitHub
parent 994a39ad6d
commit a64c9f2255
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -3,7 +3,6 @@ import _ from 'lodash';
import {connect} from 'react-redux';
import i18n from 'lib-app/i18n';
import searchTicketsUtils from 'lib-app/search-tickets-utils';
import Menu from 'core-components/menu';
import queryString from 'query-string';

View File

@ -102,11 +102,15 @@ export default {
getFiltersForURL(filtersWithShouldRemoveParams) {
const shouldRemoveCustomParam = filtersWithShouldRemoveParams.shouldRemoveCustomParam ? filtersWithShouldRemoveParams.shouldRemoveCustomParam : false;
const shouldRemoveUseInitialValuesParam = filtersWithShouldRemoveParams.shouldRemoveUseInitialValuesParam ? filtersWithShouldRemoveParams.shouldRemoveUseInitialValuesParam : false;
let filters = filtersWithShouldRemoveParams.filters;
const currentSearchParams = queryString.parse(window.location.search);
let filters = {
...currentSearchParams,
...filtersWithShouldRemoveParams.filters,
};
filters = {
...queryString.parse(window.location.search),
...filters,
query: filters.query ? encodeURIComponent(filters.query) : filters.query
};
if(shouldRemoveCustomParam) delete filters.custom;
@ -127,7 +131,7 @@ export default {
else return query + `&${filter}=${JSON.stringify(value)}`;
}, '').slice(1);
if(!_.isEqual(queryString.parse(`?${query}`), queryString.parse(window.location.search))) {
if(!_.isEqual(queryString.parse(`?${query}`), currentSearchParams)) {
return `?${query}`;
}
},