Frontend: Fix Clicking "Back to all hosts" doesn't clear filter after filtering by software (#9307)

# Addresses #8923 

# Fixes

When a user followed the flow ManageHosts > HostDetails > Software tab >
View all hosts (aka, filter all hosts by the software this row
represents), and then hit browser back, then 'Back to all hosts', the
software filter remained on the ManageHosts Page. (see #8923)

Now the filter clears correctly, while still maintaining the desired
filters if they exist (OS, team, label)
https://www.loom.com/share/a3c1d182ba5145df93d13d893833db95

# Checklist for submitter
- [x] Manual QA for all new/changed functionality

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
This commit is contained in:
Jacob Shandling 2023-01-16 12:51:49 -08:00 committed by GitHub
parent f87c28e6df
commit c8cbc65340
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -550,8 +550,9 @@ const ManageHostsPage = ({
retrieveHostCount(omit(options, "device_mapping"));
setCurrentQueryOptions(options);
}
setFilteredHostsPath(location.pathname + location.search);
if (!location.search.includes("software_id")) {
setFilteredHostsPath(location.pathname + location.search);
}
}, [availableTeams, currentTeam, location, labels]);
const isLastPage =