diff --git a/changes/issue-7463-fix-clearing-host-filters b/changes/issue-7463-fix-clearing-host-filters new file mode 100644 index 0000000000..d98d472cd1 --- /dev/null +++ b/changes/issue-7463-fix-clearing-host-filters @@ -0,0 +1 @@ +* Clearing filter pill on host detail page only clears that single filter \ No newline at end of file diff --git a/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx b/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx index 64377c2fd1..de90f3334c 100644 --- a/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx +++ b/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx @@ -681,18 +681,42 @@ const ManageHostsPage = ({ const handleClearSoftwareFilter = () => { handleResetPageIndex(); - router.replace(PATHS.MANAGE_HOSTS); + router.replace( + getNextLocationPath({ + pathPrefix: PATHS.MANAGE_HOSTS, + routeTemplate, + routeParams, + queryParams: omit(queryParams, ["software_id"]), + }) + ); setSoftwareDetails(null); }; const handleClearMDMSolutionFilter = () => { handleResetPageIndex(); - router.replace(PATHS.MANAGE_HOSTS); + + router.replace( + getNextLocationPath({ + pathPrefix: PATHS.MANAGE_HOSTS, + routeTemplate, + routeParams, + queryParams: omit(queryParams, ["mdm_id"]), + }) + ); setMDMSolutionDetails(null); }; const handleClearMDMEnrollmentFilter = () => { - router.replace(PATHS.MANAGE_HOSTS); + handleResetPageIndex(); + + router.replace( + getNextLocationPath({ + pathPrefix: PATHS.MANAGE_HOSTS, + routeTemplate, + routeParams, + queryParams: omit(queryParams, ["mdm_enrollment_status"]), + }) + ); }; const handleTeamSelect = (teamId: number) => {