diff --git a/src/components/Admin/common/RepositorySidebarOverlay/index.tsx b/src/components/Admin/common/RepositorySidebarOverlay/index.tsx index bdf33938..1560ba6a 100644 --- a/src/components/Admin/common/RepositorySidebarOverlay/index.tsx +++ b/src/components/Admin/common/RepositorySidebarOverlay/index.tsx @@ -8,6 +8,7 @@ import History, { type HistoryEntryLocation } from "../../../../history/History"; import { usePrevious } from "../../../../hooks/usePrevious"; +import { useStableSearchParams } from "../../../../hooks/useStableSearchParams"; import { digmaApi, useGetSpanInfoQuery @@ -87,6 +88,7 @@ export const RepositorySidebarOverlay = ({ () => new History([]) ); const previousIsSidebarOpen = usePrevious(isSidebarOpen); + const [, setSearchParams] = useStableSearchParams(); const { data: spanInfo } = useGetSpanInfoQuery( { spanCodeObjectId: currentSpanCodeObjectId ?? "" }, @@ -130,9 +132,17 @@ export const RepositorySidebarOverlay = ({ e: CustomEvent> ) => { setCurrentSpanCodeObjectId(e.detail.state?.spanCodeObjectId); - setCurrentTabLocation( - e.detail.state?.tabLocation ?? { id: TAB_IDS.ISSUES } - ); + const newTabLocation = e.detail.state?.tabLocation ?? { + id: TAB_IDS.ISSUES + }; + setCurrentTabLocation(newTabLocation); + setSearchParams((params) => { + if (spanInfo?.uid) { + params.set("sidebar-scope", spanInfo.uid); + } + params.set("sidebar-view", JSON.stringify(newTabLocation)); + return params; + }); }; window.addEventListener( diff --git a/src/redux/services/types.ts b/src/redux/services/types.ts index 11c58f64..6fab7028 100644 --- a/src/redux/services/types.ts +++ b/src/redux/services/types.ts @@ -1037,6 +1037,7 @@ export interface GetSpanInfoResponse { firstSeen?: string; lastSeen?: string; linkedEndpoints?: LinkedEndpoint[]; + uid?: string; } export interface GetSpanEnvironmentsPayload {