Skip to content

Commit 7052c47

Browse files
authored
feat(traces): Set page title to saved query name (#103633)
This PR tweaks the spans page to set the document title name to that of the saved query if present. This should aid users with finding the correct tab in their browser.
1 parent aa141ac commit 7052c47

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

static/app/views/explore/spans/content.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ export function ExploreContent() {
3939
Sentry.setTag('explore.visited', 'yes');
4040

4141
const organization = useOrganization();
42-
const datePageFilterProps = limitMaxPickableDays(organization);
43-
4442
const onboardingProject = useOnboardingProject();
43+
const datePageFilterProps = limitMaxPickableDays(organization);
4544

4645
return (
4746
<SentryDocumentTitle title={t('Traces')} orgSlug={organization?.slug}>
@@ -119,11 +118,18 @@ function ExploreTagsProvider({children}: SpansTabContextProps) {
119118
function SpansTabHeader() {
120119
const id = useQueryParamsId();
121120
const title = useQueryParamsTitle();
121+
const organization = useOrganization();
122122
const {data: savedQuery} = useGetSavedQuery(id);
123123

124+
const hasSavedQueryTitle =
125+
defined(id) && defined(savedQuery) && savedQuery.name.length > 0;
126+
124127
return (
125128
<Layout.Header unified>
126129
<Layout.HeaderContent unified>
130+
{hasSavedQueryTitle ? (
131+
<SentryDocumentTitle title={savedQuery.name} orgSlug={organization?.slug} />
132+
) : null}
127133
{title && defined(id) ? (
128134
<ExploreBreadcrumb traceItemDataset={TraceItemDataset.SPANS} />
129135
) : null}

0 commit comments

Comments
 (0)