Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

fix: add history replace in trace detail (#12404)

Gaurav Tewarie7dc01de4591
diff --git a/frontend/src/pages/TraceDetailsV3/TraceWaterfall/TraceWaterfallStates/Success/Success.tsx b/frontend/src/pages/TraceDetailsV3/TraceWaterfall/TraceWaterfallStates/Success/Success.tsx
index 942b36de03..e07818c2f7 100644
--- a/frontend/src/pages/TraceDetailsV3/TraceWaterfall/TraceWaterfallStates/Success/Success.tsx
+++ b/frontend/src/pages/TraceDetailsV3/TraceWaterfall/TraceWaterfallStates/Success/Success.tsx
@@ -690,7 +690,7 @@ function Success(props: ISuccessProps): JSX.Element {
urlQuery.set('spanId', span?.span_id);
}
- safeNavigate({ search: urlQuery.toString() });
+ safeNavigate({ search: urlQuery.toString() }, { replace: true });
},
[setSelectedSpan, urlQuery, safeNavigate],
);
diff --git a/frontend/src/pages/TraceDetailsV3/TraceWaterfall/TraceWaterfallStates/Success/__tests__/UnifiedSpanClick.test.tsx b/frontend/src/pages/TraceDetailsV3/TraceWaterfall/TraceWaterfallStates/Success/__tests__/UnifiedSpanClick.test.tsx
index 2743f3fa8a..75b13341bb 100644
--- a/frontend/src/pages/TraceDetailsV3/TraceWaterfall/TraceWaterfallStates/Success/__tests__/UnifiedSpanClick.test.tsx
+++ b/frontend/src/pages/TraceDetailsV3/TraceWaterfall/TraceWaterfallStates/Success/__tests__/UnifiedSpanClick.test.tsx
@@ -260,11 +260,13 @@ describe('Span Click User Flows', () => {
) as HTMLElement;
await user.click(spanElement);
- // Verify URL was updated with spanId
expect(mockUrlQuery.get('spanId')).toBe('span-1');
- expect(mockSafeNavigate).toHaveBeenCalledWith({
- search: expect.stringContaining('spanId=span-1'),
- });
+ expect(mockSafeNavigate).toHaveBeenCalledWith(
+ {
+ search: expect.stringContaining('spanId=span-1'),
+ },
+ { replace: true },
+ );
});
it('clicking span duration visually selects the span', async () => {
@@ -430,10 +432,13 @@ describe('Span Click User Flows', () => {
expect(mockUrlQuery.get('anotherParam')).toBe('anotherValue');
expect(mockUrlQuery.get('spanId')).toBe('span-1');
- expect(mockSafeNavigate).toHaveBeenCalledWith({
- search: expect.stringMatching(
- /existingParam=existingValue.*anotherParam=anotherValue.*spanId=span-1/,
- ),
- });
+ expect(mockSafeNavigate).toHaveBeenCalledWith(
+ {
+ search: expect.stringMatching(
+ /existingParam=existingValue.*anotherParam=anotherValue.*spanId=span-1/,
+ ),
+ },
+ { replace: true },
+ );
});
});
diff --git a/frontend/src/pages/TraceDetailsV3/index.tsx b/frontend/src/pages/TraceDetailsV3/index.tsx
index 3159038922..d0343b0dd5 100644
--- a/frontend/src/pages/TraceDetailsV3/index.tsx
+++ b/frontend/src/pages/TraceDetailsV3/index.tsx
@@ -80,7 +80,7 @@ function TraceDetailsV3(): JSX.Element {
const handleSpanDetailsClose = useCallback((): void => {
urlQuery.delete('spanId');
- safeNavigate({ search: urlQuery.toString() });
+ safeNavigate({ search: urlQuery.toString() }, { replace: true });
}, [urlQuery, safeNavigate]);
const handleFilteredSpansChange = useCallback(