Skip to content

Commit b9c71dd

Browse files
michellewzhangandrewshie-sentry
authored andcommitted
feat(feedback): add release hover to tags (#90684)
closes #90631 <img width="792" alt="SCR-20250430-kirm" src="https://github.com/user-attachments/assets/9da7ab9d-519a-4865-9000-85bf890b94f6" /> adds a release hovercard to the release tag, but clicking still links to old release details (default behavior of the hovercard anywhere it exists right now).
1 parent 56207be commit b9c71dd

File tree

4 files changed

+39
-8
lines changed

4 files changed

+39
-8
lines changed

static/app/components/feedback/feedbackItem/feedbackItem.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type {ReactNode} from 'react';
12
import {Fragment, useEffect, useRef} from 'react';
23
import {useTheme} from '@emotion/react';
34
import styled from '@emotion/styled';
@@ -27,7 +28,7 @@ import useOrganization from 'sentry/utils/useOrganization';
2728
interface Props {
2829
eventData: Event | undefined;
2930
feedbackItem: FeedbackIssue;
30-
tags: Record<string, string>;
31+
tags: Record<string, string | ReactNode>;
3132
}
3233

3334
export default function FeedbackItem({feedbackItem, eventData, tags}: Props) {

static/app/components/feedback/feedbackItem/tagsSection.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type {ReactNode} from 'react';
12
import styled from '@emotion/styled';
23

34
import Collapsible from 'sentry/components/collapsible';
@@ -9,7 +10,7 @@ import {t} from 'sentry/locale';
910
import {space} from 'sentry/styles/space';
1011

1112
interface Props {
12-
tags: Record<string, string>;
13+
tags: Record<string, string | ReactNode>;
1314
}
1415

1516
export default function TagsSection({tags}: Props) {

static/app/components/feedback/hydrateFeedbackTags.tsx

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,47 @@
1+
import type {ReactNode} from 'react';
2+
3+
import Version from 'sentry/components/version';
14
import type {Event} from 'sentry/types/event';
5+
import type {Organization} from 'sentry/types/organization';
6+
import {VersionContainer} from 'sentry/utils/discover/styles';
27
import type {FeedbackIssue} from 'sentry/utils/feedback/types';
8+
import {QuickContextHoverWrapper} from 'sentry/views/discover/table/quickContext/quickContextWrapper';
9+
import {ContextType} from 'sentry/views/discover/table/quickContext/utils';
10+
11+
const getReleaseTagValue = (release: string, organization: Organization) => {
12+
return (
13+
<VersionContainer>
14+
<QuickContextHoverWrapper
15+
dataRow={{release}}
16+
contextType={ContextType.RELEASE}
17+
organization={organization}
18+
>
19+
<Version version={release} truncate />
20+
</QuickContextHoverWrapper>
21+
</VersionContainer>
22+
);
23+
};
324

425
export default function hydrateFeedbackTags(
526
eventData: Event | undefined,
6-
issueData: FeedbackIssue | undefined
7-
): Record<string, string> {
27+
issueData: FeedbackIssue | undefined,
28+
organization: Organization
29+
): Record<string, string | ReactNode> {
830
if (!eventData?.contexts) {
931
return {};
1032
}
1133
const context = eventData.contexts;
1234
const eventTags = eventData.tags;
1335

1436
const unorderedTags = {
15-
...eventTags.reduce((combined, tag) => ({...combined, [tag.key]: tag.value}), {}),
37+
...eventTags.reduce(
38+
(combined, tag) => ({
39+
...combined,
40+
[tag.key]:
41+
tag.key === 'release' ? getReleaseTagValue(tag.value, organization) : tag.value,
42+
}),
43+
{}
44+
),
1645
...(context.browser?.name ? {'browser.name': context.browser.name} : {}),
1746
...(context.browser?.version ? {'browser.version': context.browser.version} : {}),
1847
...(context.device?.brand ? {'device.brand': context.device?.brand} : {}),
@@ -38,7 +67,7 @@ export default function hydrateFeedbackTags(
3867
};
3968

4069
// Sort the tags by key
41-
const tags: Record<string, string> = Object.keys(unorderedTags)
70+
const tags: Record<string, string | ReactNode> = Object.keys(unorderedTags)
4271
.sort()
4372
.reduce((acc, key) => {
4473
// @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message

static/app/components/feedback/useFetchFeedbackData.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ export default function useFetchFeedbackData({feedbackId}: Props) {
3333
);
3434

3535
const tags = useMemo(
36-
() => hydrateFeedbackTags(eventData, issueData),
37-
[eventData, issueData]
36+
() => hydrateFeedbackTags(eventData, issueData, organization),
37+
[eventData, issueData, organization]
3838
);
3939

4040
const {markAsRead} = useMutateFeedback({

0 commit comments

Comments
 (0)