From a0abf6a79c50d5fc584d89f107edbef15e55e499 Mon Sep 17 00:00:00 2001 From: RachelElysia <71795832+RachelElysia@users.noreply.github.com> Date: Mon, 12 Feb 2024 13:04:28 -0500 Subject: [PATCH] Fleet UI: Only team ID query param persists between software tables (#16733) --- frontend/pages/SoftwarePage/SoftwarePage.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/pages/SoftwarePage/SoftwarePage.tsx b/frontend/pages/SoftwarePage/SoftwarePage.tsx index ed148b3a99..5ae4946970 100644 --- a/frontend/pages/SoftwarePage/SoftwarePage.tsx +++ b/frontend/pages/SoftwarePage/SoftwarePage.tsx @@ -20,6 +20,7 @@ import teamsAPI, { ILoadTeamResponse } from "services/entities/teams"; import { AppContext } from "context/app"; import { NotificationContext } from "context/notification"; import useTeamIdParam from "hooks/useTeamIdParam"; +import { buildQueryStringFromParams } from "utilities/url"; import Button from "components/buttons/Button"; import MainContent from "components/MainContent"; @@ -256,7 +257,13 @@ const SoftwarePage = ({ children, router, location }: ISoftwarePageProps) => { const navigateToNav = useCallback( (i: number): void => { - const navPath = softwareSubNav[i].pathname.concat(location?.hash || ""); + // Only query param to persist between tabs is team id + const teamIdParam = buildQueryStringFromParams({ + team_id: location?.query.team_id, + }); + + const navPath = softwareSubNav[i].pathname.concat(`?${teamIdParam}`); + router.replace(navPath); }, [location, router]