Manage Host Page (Bug fix): Transfer and delete hosts updates total host count (#2501)

* refetchHosts includes retrieveHosts and retrieveHostCount
This commit is contained in:
RachelElysia 2021-10-13 11:30:01 -04:00 committed by GitHub
parent 01d38150c8
commit 3ca3b1c823
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -0,0 +1 @@
* Bug fix: Transferring and deleting hosts updates host count

View file

@ -332,6 +332,11 @@ const ManageHostsPage = ({
}
};
const refetchHosts = (options: IHostCountLoadOptions) => {
retrieveHosts(options);
retrieveHostCount(options);
};
// triggered every time the route is changed
// which means every filter click and text search
useDeepEffect(() => {
@ -743,7 +748,7 @@ const ManageHostsPage = ({
: `Hosts successfully transferred to ${team.name}.`;
dispatch(renderFlash("success", successMessage));
retrieveHosts({
refetchHosts({
selectedLabels: selectedFilters,
globalFilter: searchQuery,
sortBy,
@ -788,7 +793,7 @@ const ManageHostsPage = ({
} successfully deleted.`;
dispatch(renderFlash("success", successMessage));
retrieveHosts({
refetchHosts({
selectedLabels: selectedFilters,
globalFilter: searchQuery,
sortBy,
@ -796,6 +801,7 @@ const ManageHostsPage = ({
policyId,
policyResponse,
});
refetchLabels();
toggleDeleteHostModal();
setSelectedHostIds([]);