Allow deselecting values when using search through url query params

pull/1841/head
Bogdan 1 year ago
parent 39a54eb8f6
commit 0eaa538e8a

@ -24,6 +24,7 @@ class SearchFooter extends Component {
super(props, context);
const {
defaultSearchQueryParams,
defaultIndexerIds,
defaultCategories,
defaultSearchQuery,
@ -33,16 +34,16 @@ class SearchFooter extends Component {
} = props;
this.state = {
isQueryParameterModalOpen: false,
queryModalOptions: null,
searchType: defaultSearchType,
searchIndexerIds: defaultSearchQueryParams.searchIndexerIds ?? defaultIndexerIds,
searchCategories: defaultSearchQueryParams.searchCategories ?? defaultCategories,
searchQuery: (defaultSearchQueryParams.searchQuery ?? defaultSearchQuery) || '',
searchType: defaultSearchQueryParams.searchType ?? defaultSearchType,
searchLimit: defaultSearchQueryParams.searchLimit ?? defaultSearchLimit,
searchOffset: defaultSearchQueryParams.searchOffset ?? defaultSearchOffset,
newSearch: true,
searchingReleases: false,
searchQuery: defaultSearchQuery || '',
searchIndexerIds: defaultIndexerIds,
searchCategories: defaultCategories,
searchLimit: defaultSearchLimit,
searchOffset: defaultSearchOffset,
newSearch: true
isQueryParameterModalOpen: false,
queryModalOptions: null
};
}
@ -189,6 +190,7 @@ class SearchFooter extends Component {
break;
default:
icon = icons.SEARCH;
break;
}
let footerLabel = searchIndexerIds.length === 0 ? translate('SearchAllIndexers') : translate('SearchCountIndexers', { count: searchIndexerIds.length });
@ -300,6 +302,7 @@ class SearchFooter extends Component {
}
SearchFooter.propTypes = {
defaultSearchQueryParams: PropTypes.object.isRequired,
defaultIndexerIds: PropTypes.arrayOf(PropTypes.number).isRequired,
defaultCategories: PropTypes.arrayOf(PropTypes.number).isRequired,
defaultSearchQuery: PropTypes.string.isRequired,

@ -49,12 +49,12 @@ function createMapStateToProps() {
return {
defaultSearchQueryParams,
defaultSearchQuery: defaultSearchQueryParams.searchQuery ?? defaultSearchQuery,
defaultIndexerIds: defaultSearchQueryParams.searchIndexerIds ?? defaultIndexerIds,
defaultCategories: defaultSearchQueryParams.searchCategories ?? defaultCategories,
defaultSearchType: defaultSearchQueryParams.searchType ?? defaultSearchType,
defaultSearchLimit: defaultSearchQueryParams.searchLimit ?? defaultSearchLimit,
defaultSearchOffset: defaultSearchQueryParams.searchOffset ?? defaultSearchOffset
defaultSearchQuery,
defaultIndexerIds,
defaultCategories,
defaultSearchType,
defaultSearchLimit,
defaultSearchOffset
};
}
);
@ -87,14 +87,9 @@ class SearchFooterConnector extends Component {
// Render
render() {
const {
defaultSearchQueryParams,
...otherProps
} = this.props;
return (
<SearchFooter
{...otherProps}
{...this.props}
onInputChange={this.onInputChange}
/>
);

Loading…
Cancel
Save