Skip to content

Commit 09c4240

Browse files
authored
fix(insights): Close span samples panel when navigating to a trace view (#83699)
Right now, clicking on a span ID in the panel keeps the panel open, and navigates to the trace view. Closing the panel then calls the `onClose` callback, and sometimes clobbers the URL. Navigating to the sample view should close the panel, this PR adds that check. This is a hotfix, the proper solution is to make the navigation behaviour more robust, probably by rendering the panel view at a `/samples/` sub-route, which is easier to detect on navigation.
1 parent 7557b50 commit 09c4240

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

static/app/views/insights/common/utils/useSamplesDrawer.tsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,15 @@ export function useSamplesDrawer({
5454

5555
const shouldCloseOnLocationChange = useCallback(
5656
(newLocation: Location) => {
57-
return !requiredParams.some(paramName => Boolean(newLocation.query[paramName]));
57+
if (!requiredParams.every(paramName => Boolean(newLocation.query[paramName]))) {
58+
return true;
59+
}
60+
61+
if (newLocation.pathname.includes('/trace/')) {
62+
return true;
63+
}
64+
65+
return false;
5866
},
5967
[requiredParams]
6068
);

0 commit comments

Comments
 (0)