diff --git a/js/router.js b/js/router.js index 76aa4c70..d3fb1de4 100644 --- a/js/router.js +++ b/js/router.js @@ -78,9 +78,16 @@ const router = { router.update(); }, - updateSearch(key, value) { + /** + * @param {Object|string} what - an object or a single key + * @param {string} [value] - for `key` mode + */ + updateSearch(what, value) { const u = new URL(location); - u.searchParams[value ? 'set' : 'delete'](key, value); + const entries = typeof what === 'object' ? Object.entries(what) : [[what, value]]; + for (const [key, val] of entries) { + u.searchParams[val ? 'set' : 'delete'](key, val); + } history.replaceState(history.state, null, `${u}`); router.update(true); }, diff --git a/manage/filters.js b/manage/filters.js index 0484fa04..ca326a38 100644 --- a/manage/filters.js +++ b/manage/filters.js @@ -114,7 +114,7 @@ function initFilters() { } } filterOnChange({forceRefilter: true}); - router.updateSearch('search', ''); + router.updateSearch({search: '', searchMode: ''}); }; filterOnChange({forceRefilter: true});