Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 16 additions & 19 deletions src/components/Admin/common/RepositorySidebarOverlay/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import History, {
type HistoryEntry,
type HistoryEntryLocation
} from "../../../../history/History";
import { usePrevious } from "../../../../hooks/usePrevious";
import {
digmaApi,
useGetSpanInfoQuery
Expand Down Expand Up @@ -70,18 +71,10 @@ export const RepositorySidebarOverlay = ({
);
const { resetInsights, resetAssets, resetGlobalErrors } = useStore.getState();
const dispatch = useAdminDispatch();
const [history] = useState(
() =>
new History<RepositorySidebarHistoryState>([
{
location: window.location,
state: {
spanCodeObjectId: currentSpanCodeObjectId,
tabLocation: currentTabLocation
}
}
])
const [history, setHistory] = useState(
() => new History<RepositorySidebarHistoryState>([])
);
const previousIsSidebarOpen = usePrevious(isSidebarOpen);

const { data: spanInfo } = useGetSpanInfoQuery(
{ spanCodeObjectId: currentSpanCodeObjectId ?? "" },
Expand Down Expand Up @@ -172,17 +165,21 @@ export const RepositorySidebarOverlay = ({
resetInsights();
resetAssets();
resetGlobalErrors();
history.clear();
setCurrentTabLocation(initialTabLocation);
setCurrentSpanCodeObjectId(undefined);
setCurrentTabLocation(initialTabLocation);
onSidebarClose();
}, [dispatch, onSidebarClose, resetAssets, resetGlobalErrors, resetInsights]);

// Reset history on sidebar open
useEffect(() => {
if (!previousIsSidebarOpen && isSidebarOpen) {
setHistory(new History<RepositorySidebarHistoryState>([]));
}
}, [
dispatch,
onSidebarClose,
resetAssets,
resetGlobalErrors,
resetInsights,
history
previousIsSidebarOpen,
isSidebarOpen,
currentSpanCodeObjectId,
currentTabLocation
]);

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const InsightIcon = ({
return (
<Tag
title={<InsightIconTooltip {...{ severity, impact, criticality }} />}
titlePlacement={"bottom"}
titlePlacement={"bottom-start"}
type={tagType}
content={
<s.InsightIconContainer>
Expand Down
Loading