Skip to content

Commit 9afa04d

Browse files
authored
fix(trace): remove click outside (#69862)
Remove deselecting of current node and only fire the default blur event on the current row clicked
1 parent 052229e commit 9afa04d

File tree

2 files changed

+5
-30
lines changed

2 files changed

+5
-30
lines changed

static/app/views/performance/newTraceDetails/index.tsx

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ import {
4242
type DispatchingReducerMiddleware,
4343
useDispatchingReducer,
4444
} from 'sentry/utils/useDispatchingReducer';
45-
import useOnClickOutside from 'sentry/utils/useOnClickOutside';
4645
import useOrganization from 'sentry/utils/useOrganization';
4746
import {useParams} from 'sentry/utils/useParams';
4847
import useProjects from 'sentry/utils/useProjects';
@@ -718,33 +717,8 @@ function TraceViewContent(props: TraceViewContentProps) {
718717
storeTraceViewPreferences(traceState.preferences);
719718
}, [traceState.preferences]);
720719

721-
// Setup outside click handler so that we can clear the currently clicked node
722-
const onOutsideTraceContainerClick = useCallback(() => {
723-
if (tree.type !== 'trace') {
724-
// Dont clear the URL in case the trace is still loading or failed for some reason,
725-
// we want to keep the eventId in the URL so the user can share the URL with support
726-
return;
727-
}
728-
// we will drop eventId such that after users clicks outside and shares the URL
729-
const {
730-
node: _node,
731-
eventId: _eventId,
732-
...queryParamsWithoutNode
733-
} = qs.parse(location.search);
734-
735-
browserHistory.push({
736-
pathname: location.pathname,
737-
query: queryParamsWithoutNode,
738-
});
739-
740-
traceDispatch({type: 'clear'});
741-
}, [tree, traceDispatch]);
742-
743-
const [clickOutsideRef, setClickOutsideRef] = useState<HTMLElement | null>(null);
744720
const [traceGridRef, setTraceGridRef] = useState<HTMLElement | null>(null);
745721

746-
useOnClickOutside(clickOutsideRef, onOutsideTraceContainerClick);
747-
748722
return (
749723
<TraceExternalLayout>
750724
<TraceUXChangeAlert />
@@ -763,7 +737,7 @@ function TraceViewContent(props: TraceViewContentProps) {
763737
traces={props.trace}
764738
traceID={props.traceSlug}
765739
/>
766-
<TraceInnerLayout ref={setClickOutsideRef}>
740+
<TraceInnerLayout>
767741
<TraceToolbar>
768742
<TraceSearchInput
769743
trace_state={traceState}

static/app/views/performance/newTraceDetails/trace.spec.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,9 +1287,10 @@ describe('trace view', () => {
12871287
expect(screen.queryAllByTestId(DRAWER_TABS_TEST_ID)).toHaveLength(3);
12881288
});
12891289

1290-
await userEvent.click(
1291-
await screen.findAllByTestId(DRAWER_TABS_PIN_BUTTON_TEST_ID)[0]
1292-
);
1290+
const tabButtons = screen.queryAllByTestId(DRAWER_TABS_PIN_BUTTON_TEST_ID);
1291+
expect(tabButtons).toHaveLength(2);
1292+
1293+
await userEvent.click(tabButtons[0]);
12931294
await waitFor(() => {
12941295
expect(screen.queryAllByTestId(DRAWER_TABS_TEST_ID)).toHaveLength(2);
12951296
});

0 commit comments

Comments
 (0)