Fleet UI: Fix host software filter dropdown to persist other changes (#22392)

This commit is contained in:
RachelElysia
2024-09-26 07:42:53 -07:00
committed by GitHub
parent b7e8031b6f
commit e68dafe3a7
2 changed files with 9 additions and 1 deletions
+1
View File
@@ -0,0 +1 @@
- Fleet UI: Fix host software filter bug that resets dropdown filter on table changes (pagination, order by column, etc)
@@ -118,6 +118,7 @@ const HostSoftwareTable = ({
/>
);
}, [handleFilterDropdownChange, hostSoftwareFilter]);
const determineQueryParamChange = useCallback(
(newTableQuery: ITableQueryData) => {
const changedEntry = Object.entries(newTableQuery).find(([key, val]) => {
@@ -148,9 +149,15 @@ const HostSoftwareTable = ({
page: changedParam === "pageIndex" ? newTableQuery.pageIndex : 0,
};
if (hostSoftwareFilter === "vulnerableSoftware") {
newQueryParam.vulnerable = "true";
} else if (hostSoftwareFilter === "installableSoftware") {
newQueryParam.available_for_install = "true";
}
return newQueryParam;
},
[]
[hostSoftwareFilter]
);
// TODO: Look into useDebounceCallback with dependencies