Skip to content

Commit 8e57f23

Browse files
committed
ref(issue-details): Remove useHasStreamlinedUI hook and legacy UI code
Remove the useHasStreamlinedUI hook which always returned true, and clean up all legacy (non-streamlined) UI code paths that were gated behind it. This removes dead code including unused styled components, the old tab-based layout, and legacy conditional branches across groupEventDetailsContent, groupEventDetails, and groupDetails. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Agent transcript: https://claudescope.sentry.dev/share/GEUTjwTLS-03zoOgJLc4nNOPl6d6kawqWXMe3Bn-fOQ
1 parent b06ca47 commit 8e57f23

File tree

7 files changed

+24
-376
lines changed

7 files changed

+24
-376
lines changed

static/app/components/activity/note/inputWithStorage.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import type {MentionChangeEvent} from 'sentry/components/activity/note/types';
77
import type {NoteType} from 'sentry/types/alerts';
88
import {localStorageWrapper} from 'sentry/utils/localStorage';
99
import {StreamlinedNoteInput} from 'sentry/views/issueDetails/streamline/sidebar/note';
10-
import {useHasStreamlinedUI} from 'sentry/views/issueDetails/utils';
1110

1211
type InputProps = React.ComponentProps<typeof NoteInput>;
1312

@@ -61,7 +60,6 @@ function NoteInputWithStorage({
6160
source,
6261
...props
6362
}: Props) {
64-
const hasStreamlinedUi = useHasStreamlinedUI();
6563
const value = useMemo(() => {
6664
if (text) {
6765
return text;
@@ -137,7 +135,7 @@ function NoteInputWithStorage({
137135
);
138136

139137
// Make sure `this.props` does not override `onChange` and `onCreate`
140-
if (hasStreamlinedUi && source === 'issue-details') {
138+
if (source === 'issue-details') {
141139
return (
142140
<StreamlinedNoteInput
143141
text={value}

static/app/components/events/packageData.spec.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ import {textWithMarkupMatcher} from 'sentry-test/utils';
77

88
import {EventPackageData} from 'sentry/components/events/packageData';
99

10-
jest.mock('sentry/views/issueDetails/utils', () => ({
11-
...jest.requireActual('sentry/views/issueDetails/utils'),
12-
useHasStreamlinedUI: () => true,
13-
}));
14-
1510
describe('EventPackageData', () => {
1611
const event = EventFixture({
1712
packages: {

static/app/views/issueDetails/groupDetails.tsx

Lines changed: 4 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import isEqual from 'lodash/isEqual';
66
import * as qs from 'query-string';
77

88
import {Container} from '@sentry/scraps/layout';
9-
import {TabPanels, Tabs} from '@sentry/scraps/tabs';
109

1110
import {FloatingFeedbackButton} from 'sentry/components/feedbackButton/floatingFeedbackButton';
1211
import {useDrawer} from 'sentry/components/globalDrawer';
@@ -22,11 +21,10 @@ import {t} from 'sentry/locale';
2221
import {GroupStore} from 'sentry/stores/groupStore';
2322
import type {Event} from 'sentry/types/event';
2423
import type {Group} from 'sentry/types/group';
25-
import {GroupStatus, IssueCategory, IssueType} from 'sentry/types/group';
24+
import {GroupStatus, IssueType} from 'sentry/types/group';
2625
import type {Organization} from 'sentry/types/organization';
2726
import type {Project} from 'sentry/types/project';
2827
import {defined} from 'sentry/utils';
29-
import {trackAnalytics} from 'sentry/utils/analytics';
3028
import {getUtcDateString} from 'sentry/utils/dates';
3129
import {
3230
getAnalyticsDataForEvent,
@@ -55,7 +53,6 @@ import {useUser} from 'sentry/utils/useUser';
5553
import {ERROR_TYPES} from 'sentry/views/issueDetails/constants';
5654
import {useGroupDistributionsDrawer} from 'sentry/views/issueDetails/groupDistributions/useGroupDistributionsDrawer';
5755
import GroupEventDetails from 'sentry/views/issueDetails/groupEventDetails/groupEventDetails';
58-
import {GroupHeader} from 'sentry/views/issueDetails/header';
5956
import {
6057
ISSUE_DETAILS_TOUR_GUIDE_KEY,
6158
IssueDetailsTourContext,
@@ -80,7 +77,6 @@ import {
8077
ReprocessingStatus,
8178
useDefaultIssueEvent,
8279
useEnvironmentsFromUrl,
83-
useHasStreamlinedUI,
8480
useIsSampleEvent,
8581
} from 'sentry/views/issueDetails/utils';
8682

@@ -234,8 +230,6 @@ function useFetchGroupDetails(): FetchGroupDetailsState {
234230
const location = useLocation();
235231
const params = useParams<{groupId: string; eventId?: string}>();
236232
const navigate = useNavigate();
237-
const defaultIssueEvent = useDefaultIssueEvent();
238-
const hasStreamlinedUI = useHasStreamlinedUI();
239233
const {projects} = useProjects();
240234

241235
const [allProjectChanged, setAllProjectChanged] = useState<boolean>(false);
@@ -248,7 +242,6 @@ function useFetchGroupDetails(): FetchGroupDetailsState {
248242
const {
249243
data: event,
250244
isPending: loadingEvent,
251-
isError: isEventError,
252245
refetch: refetchEvent,
253246
} = useGroupEvent({
254247
groupId,
@@ -263,50 +256,6 @@ function useFetchGroupDetails(): FetchGroupDetailsState {
263256
refetch: refetchGroupCall,
264257
} = useGroup({groupId});
265258

266-
/**
267-
* TODO(streamline-ui): Remove this whole hook once the legacy UI is removed. The streamlined UI exposes the
268-
* filters on the page so the user is expected to clear it themselves, and the empty state is actually expected.
269-
*/
270-
useEffect(() => {
271-
if (hasStreamlinedUI) {
272-
return;
273-
}
274-
275-
const eventIdUrl = params.eventId ?? defaultIssueEvent;
276-
const isLatestOrRecommendedEvent =
277-
eventIdUrl === 'latest' || eventIdUrl === 'recommended';
278-
279-
if (
280-
isLatestOrRecommendedEvent &&
281-
isEventError &&
282-
// Expanding this list to ensure invalid date ranges get removed as well as queries
283-
(location.query.query ||
284-
location.query.start ||
285-
location.query.end ||
286-
location.query.statsPeriod)
287-
) {
288-
// If we get an error from the helpful event endpoint, it probably means
289-
// the query failed validation. We should remove the query to try again if
290-
// we are not using streamlined UI.
291-
navigate(
292-
{
293-
...location,
294-
query: {
295-
project: location.query.project,
296-
},
297-
},
298-
{replace: true}
299-
);
300-
}
301-
}, [
302-
defaultIssueEvent,
303-
isEventError,
304-
navigate,
305-
location,
306-
params.eventId,
307-
hasStreamlinedUI,
308-
]);
309-
310259
/**
311260
* Allows the GroupEventHeader to display the previous event while the new event is loading.
312261
* This is not closer to the GroupEventHeader because it is unmounted
@@ -525,7 +474,6 @@ function useTrackView({
525474
location.query;
526475
const groupEventType = useLoadedEventType();
527476
const user = useUser();
528-
const hasStreamlinedUI = useHasStreamlinedUI();
529477

530478
useRouteAnalyticsEventNames('issue_details.viewed', 'Issue Details: Viewed');
531479
useRouteAnalyticsParams({
@@ -544,7 +492,7 @@ function useTrackView({
544492
prefers_streamlined_ui: user?.options?.prefersIssueDetailsStreamlinedUI ?? false,
545493
enforced_streamlined_ui: user?.options?.prefersIssueDetailsStreamlinedUI === null,
546494
org_streamline_only: organization.streamlineOnly ?? undefined,
547-
has_streamlined_ui: hasStreamlinedUI,
495+
has_streamlined_ui: true,
548496
has_seer_access: hasAutofixQuota,
549497
notification_uuid:
550498
typeof notification_uuid === 'string' ? notification_uuid : undefined,
@@ -580,51 +528,6 @@ function useTrackView({
580528
useDisableRouteAnalytics(!group || !event || !project);
581529
}
582530

583-
const trackTabChanged = ({
584-
organization,
585-
project,
586-
group,
587-
event,
588-
tab,
589-
}: {
590-
event: Event | null;
591-
group: Group;
592-
organization: Organization;
593-
project: Project;
594-
tab: Tab;
595-
}) => {
596-
if (!project || !group) {
597-
return;
598-
}
599-
600-
trackAnalytics('issue_details.tab_changed', {
601-
organization,
602-
project_id: parseInt(project.id, 10),
603-
tab,
604-
...getAnalyticsDataForGroup(group),
605-
});
606-
607-
if (group.issueCategory !== IssueCategory.ERROR) {
608-
return;
609-
}
610-
611-
const analyticsData = event
612-
? event.tags
613-
.filter(({key}) => ['device', 'os', 'browser'].includes(key))
614-
.reduce<Record<string, string>>((acc, {key, value}) => {
615-
acc[key] = value;
616-
return acc;
617-
}, {})
618-
: {};
619-
620-
trackAnalytics('issue_group_details.tab.clicked', {
621-
organization,
622-
tab,
623-
platform: project.platform,
624-
...analyticsData,
625-
});
626-
};
627-
628531
function GroupDetailsContentError({
629532
errorType,
630533
onRetry,
@@ -678,14 +581,13 @@ function GroupDetailsContent({
678581
const {openSeerDrawer} = useOpenSeerDrawer({group, project, event});
679582
const {isDrawerOpen} = useDrawer();
680583

681-
const {currentTab, baseUrl} = useGroupDetailsRoute();
584+
const {currentTab} = useGroupDetailsRoute();
682585
const {seerDrawer} = useLocationQuery({
683586
fields: {
684587
seerDrawer: decodeBoolean,
685588
},
686589
});
687590

688-
const hasStreamlinedUI = useHasStreamlinedUI();
689591
const {hasAutofixQuota} = useAiConfig(group, project);
690592

691593
useEffect(() => {
@@ -698,10 +600,6 @@ function GroupDetailsContent({
698600
return;
699601
}
700602

701-
if (!hasStreamlinedUI) {
702-
return;
703-
}
704-
705603
if (currentTab === Tab.DISTRIBUTIONS) {
706604
// Tag and feature flag distributions.
707605
openDistributionsDrawer();
@@ -714,7 +612,6 @@ function GroupDetailsContent({
714612
}
715613
}, [
716614
currentTab,
717-
hasStreamlinedUI,
718615
isDrawerOpen,
719616
seerDrawer,
720617
openDistributionsDrawer,
@@ -743,7 +640,7 @@ function GroupDetailsContent({
743640
Tab.ACTIVITY,
744641
].includes(currentTab);
745642

746-
return hasStreamlinedUI ? (
643+
return (
747644
<GroupDetailsLayout group={group} event={event ?? undefined} project={project}>
748645
{isDisplayingEventDetails ? (
749646
// The router displays a loading indicator when switching to any of these tabs
@@ -753,22 +650,6 @@ function GroupDetailsContent({
753650
children
754651
)}
755652
</GroupDetailsLayout>
756-
) : (
757-
<Tabs
758-
value={currentTab}
759-
onChange={tab => trackTabChanged({tab, group, project, event, organization})}
760-
>
761-
<GroupHeader
762-
organization={organization}
763-
event={event}
764-
group={group}
765-
baseUrl={baseUrl}
766-
project={project}
767-
/>
768-
<GroupTabPanels>
769-
<TabPanels.Item key={currentTab}>{children}</TabPanels.Item>
770-
</GroupTabPanels>
771-
</Tabs>
772653
);
773654
}
774655

@@ -941,11 +822,3 @@ export default Sentry.withProfiler(GroupDetails);
941822
const StyledLoadingError = styled(LoadingError)`
942823
margin: ${p => p.theme.space.xl};
943824
`;
944-
945-
const GroupTabPanels = styled(TabPanels)`
946-
flex-grow: 1;
947-
display: flex;
948-
flex-direction: column;
949-
justify-content: stretch;
950-
padding-top: 0;
951-
`;

0 commit comments

Comments
 (0)