diff --git a/static/js/src/cve/cve.js b/static/js/src/cve/cve.js index 7dd17885b27..480064dd7ec 100644 --- a/static/js/src/cve/cve.js +++ b/static/js/src/cve/cve.js @@ -212,15 +212,14 @@ handleFilterPersist(); function handleClearFilters() { if (clearFiltersButton) { clearFiltersButton.addEventListener("click", function (event) { - for (const [param] of urlParams.entries()) { - if (urlParams.has("q")) { - if (param != "q") { - urlParams.delete(param); - } - } else { - urlParams.append("q", ""); - } - } + let keys = [...urlParams.keys()]; + keys.forEach((key) => { + urlParams.delete(key); + }); + // Always leave this empty param on clear + // so the user is not redirected to the landing page + urlParams.set("q", ""); + url.search = urlParams.toString(); window.location.href = url.href; }); diff --git a/templates/security/cves/index.html b/templates/security/cves/index.html index 8ff57dd418c..876b2eaf200 100644 --- a/templates/security/cves/index.html +++ b/templates/security/cves/index.html @@ -29,7 +29,7 @@