From 2a718087cc27514e4c61fb6fbe9b1dfcac1e9b3a Mon Sep 17 00:00:00 2001 From: RachelElysia <71795832+RachelElysia@users.noreply.github.com> Date: Fri, 9 Feb 2024 09:16:44 -0500 Subject: [PATCH] (Released Bugs) Fleet UI: Fix software query params bugs (#16682) --- changes/16672-software-url-states-bug | 2 ++ frontend/pages/SoftwarePage/SoftwarePage.tsx | 6 ++---- .../SoftwareTitles/SoftwareTable/SoftwareTable.tsx | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 changes/16672-software-url-states-bug diff --git a/changes/16672-software-url-states-bug b/changes/16672-software-url-states-bug new file mode 100644 index 0000000000..7fcd985dac --- /dev/null +++ b/changes/16672-software-url-states-bug @@ -0,0 +1,2 @@ +- Fix URL query params to reset when switching tabs +- Fix vulnerable software dropdown from switching back to all teams diff --git a/frontend/pages/SoftwarePage/SoftwarePage.tsx b/frontend/pages/SoftwarePage/SoftwarePage.tsx index 6718b86ae8..ed148b3a99 100644 --- a/frontend/pages/SoftwarePage/SoftwarePage.tsx +++ b/frontend/pages/SoftwarePage/SoftwarePage.tsx @@ -256,10 +256,8 @@ const SoftwarePage = ({ children, router, location }: ISoftwarePageProps) => { const navigateToNav = useCallback( (i: number): void => { - const navPath = softwareSubNav[i].pathname; - router.replace( - navPath.concat(location?.search || "").concat(location?.hash || "") - ); + const navPath = softwareSubNav[i].pathname.concat(location?.hash || ""); + router.replace(navPath); }, [location, router] ); diff --git a/frontend/pages/SoftwarePage/SoftwareTitles/SoftwareTable/SoftwareTable.tsx b/frontend/pages/SoftwarePage/SoftwareTitles/SoftwareTable/SoftwareTable.tsx index e3b8106b2f..8996791cd2 100644 --- a/frontend/pages/SoftwarePage/SoftwareTitles/SoftwareTable/SoftwareTable.tsx +++ b/frontend/pages/SoftwarePage/SoftwareTitles/SoftwareTable/SoftwareTable.tsx @@ -207,9 +207,9 @@ const SoftwareTable = ({ routeTemplate: "", queryParams: { query, - teamId, - orderDirection, - orderKey, + team_id: teamId, + order_direction: orderDirection, + order_key: orderKey, vulnerable: isFilterVulnerable, page: 0, // resets page index },