Skip to content

Commit 33e02db

Browse files
authored
ref(issue-details): Minor improvements (#75990)
- Messages now always display with white-space preserved, even if annotated <img width="1056" alt="Screenshot 2024-08-12 at 12 36 06 PM" src="https://github.com/user-attachments/assets/7bc5b795-4056-444e-9dae-99812c36d939"> - Breadcrumbs with no type/category still say `generic`, before they were rendering empty. Animation speed lowered (higher spring stiffness) <img width="1133" alt="Screenshot 2024-08-12 at 12 35 55 PM" src="https://github.com/user-attachments/assets/e314904d-42e9-4279-ab15-eb67db8360f8"> <img width="1089" alt="Screenshot 2024-08-12 at 12 35 25 PM" src="https://github.com/user-attachments/assets/b0351023-16d0-4340-86cc-e5508c9594a5"> - Context section no longer renders title if empty <img width="1143" alt="image" src="https://github.com/user-attachments/assets/58d840ee-4d1f-482b-bcea-a079b8715d17"> - Suspect Root Cause and LLM sections fold <img width="1208" alt="image" src="https://github.com/user-attachments/assets/c897f71e-3410-469d-8dcb-cc90ff3f8be2">
1 parent 8d83d21 commit 33e02db

File tree

11 files changed

+42
-19
lines changed

11 files changed

+42
-19
lines changed

static/app/components/events/breadcrumbs/breadcrumbsDataSection.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ export default function BreadcrumbsDataSection({
105105
}
106106
return true;
107107
},
108+
transitionProps: {stiffness: 1000},
108109
}
109110
);
110111
},

static/app/components/events/breadcrumbs/utils.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ export function getEnhancedBreadcrumbs(event: Event): EnhancedCrumb[] {
227227

228228
function getBreadcrumbTitle(crumb: RawCrumb) {
229229
if (crumb?.type === BreadcrumbType.DEFAULT) {
230-
return crumb?.category;
230+
return crumb?.category ?? BREADCRUMB_TITLE_PLACEHOLDER.toLocaleLowerCase();
231231
}
232232

233233
switch (crumb?.category) {

static/app/components/events/contexts/contextDataSection.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ export default function ContextDataSection({
3636
)
3737
);
3838

39+
if (!cards.length) {
40+
return null;
41+
}
42+
3943
return (
4044
<InterimSection
4145
key={'context'}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ describe('EventEntries', function () {
5454
);
5555

5656
await waitFor(() => {
57-
expect(screen.getAllByTestId(/event-section/)).toHaveLength(5); // event tags + 3 entries + event grouping
57+
expect(screen.getAllByTestId(/event-section/)).toHaveLength(4); // event tags + 2 entries + event grouping
5858
});
5959

6060
const sections = screen.getAllByTestId(/event-section/);

static/app/components/events/interfaces/llm-monitoring/llmMonitoringSection.tsx

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import Alert from 'sentry/components/alert';
22
import {LinkButton} from 'sentry/components/button';
33
import ButtonBar from 'sentry/components/buttonBar';
4-
import {EventDataSection} from 'sentry/components/events/eventDataSection';
54
import {IconOpen} from 'sentry/icons';
65
import {t} from 'sentry/locale';
76
import type {Event} from 'sentry/types/event';
@@ -15,6 +14,8 @@ import {
1514
TotalTokensUsedChart,
1615
} from 'sentry/views/insights/llmMonitoring/components/charts/llmMonitoringCharts';
1716
import {SpanIndexedField, type SpanIndexedResponse} from 'sentry/views/insights/types';
17+
import {FoldSectionKey} from 'sentry/views/issueDetails/streamline/foldSection';
18+
import {InterimSection} from 'sentry/views/issueDetails/streamline/interimSection';
1819

1920
interface Props {
2021
event: Event;
@@ -45,9 +46,9 @@ export default function LLMMonitoringSection({event}: Props) {
4546
);
4647

4748
return (
48-
<EventDataSection
49+
<InterimSection
4950
title={t('LLM monitoring')}
50-
type="llm-monitoring"
51+
type={FoldSectionKey.LLM_MONITORING}
5152
help={t('Charts showing how many tokens are being used')}
5253
actions={actions}
5354
>
@@ -67,6 +68,6 @@ export default function LLMMonitoringSection({event}: Props) {
6768
</ModuleLayout.Half>
6869
</ModuleLayout.Layout>
6970
)}
70-
</EventDataSection>
71+
</InterimSection>
7172
);
7273
}

static/app/components/events/interfaces/message.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,9 @@ export function Message({data, event}: Props) {
5959

6060
return (
6161
<InterimSection title={t('Message')} type={FoldSectionKey.MESSAGE}>
62-
{meta?.data?.formatted?.[''] ? (
63-
<AnnotatedText value={messageData} meta={meta?.data?.formatted?.['']} />
64-
) : (
65-
<pre className="plain">{messageData}</pre>
66-
)}
62+
<pre className="plain">
63+
{<AnnotatedText value={messageData} meta={meta?.data?.formatted?.['']} />}
64+
</pre>
6765
{renderParams(data.params, meta)}
6866
</InterimSection>
6967
);

static/app/components/events/interfaces/performance/anrRootCause.tsx

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {Fragment, useContext, useEffect} from 'react';
22
import styled from '@emotion/styled';
33

4-
import {EventDataSection} from 'sentry/components/events/eventDataSection';
54
import {analyzeFramesForRootCause} from 'sentry/components/events/interfaces/analyzeFrames';
65
import {StackTraceContent} from 'sentry/components/events/interfaces/crashContent/stackTrace';
76
import NoStackTraceMessage from 'sentry/components/events/interfaces/noStackTraceMessage';
@@ -18,6 +17,8 @@ import {defined} from 'sentry/utils';
1817
import {trackAnalytics} from 'sentry/utils/analytics';
1918
import {QuickTraceContext} from 'sentry/utils/performance/quickTrace/quickTraceContext';
2019
import useProjects from 'sentry/utils/useProjects';
20+
import {FoldSectionKey} from 'sentry/views/issueDetails/streamline/foldSection';
21+
import {InterimSection} from 'sentry/views/issueDetails/streamline/interimSection';
2122

2223
enum AnrRootCauseAllowlist {
2324
PERFORMANCE_FILE_IO_MAIN_THREAD_GROUP_TYPE = 1008,
@@ -113,9 +114,9 @@ export function AnrRootCause({event, organization}: Props) {
113114
}
114115

115116
return (
116-
<EventDataSection
117+
<InterimSection
117118
title={t('Suspect Root Cause')}
118-
type="suspect-root-cause"
119+
type={FoldSectionKey.SUSPECT_ROOT_CAUSE}
119120
help={helpText}
120121
>
121122
{potentialAnrRootCause?.map(issue => {
@@ -149,7 +150,7 @@ export function AnrRootCause({event, organization}: Props) {
149150
);
150151
})}
151152
{organization.features.includes('anr-analyze-frames') && renderAnrCulprit()}
152-
</EventDataSection>
153+
</InterimSection>
153154
);
154155
}
155156

static/app/components/globalDrawer/components.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {createContext, forwardRef, Fragment, useContext} from 'react';
22
import styled from '@emotion/styled';
3+
import type {AnimationProps} from 'framer-motion';
34

45
import {Button} from 'sentry/components/button';
56
import type {DrawerOptions} from 'sentry/components/globalDrawer';
@@ -27,10 +28,11 @@ interface DrawerPanelProps {
2728
children: React.ReactNode;
2829
headerContent: React.ReactNode;
2930
onClose: DrawerContentContextType['onClose'];
31+
transitionProps?: AnimationProps['transition'];
3032
}
3133

3234
export const DrawerPanel = forwardRef(function _DrawerPanel(
33-
{ariaLabel, children, onClose}: DrawerPanelProps,
35+
{ariaLabel, children, transitionProps, onClose}: DrawerPanelProps,
3436
ref: React.ForwardedRef<HTMLDivElement>
3537
) {
3638
return (
@@ -40,6 +42,7 @@ export const DrawerPanel = forwardRef(function _DrawerPanel(
4042
slidePosition="right"
4143
collapsed={false}
4244
ref={ref}
45+
transitionProps={transitionProps}
4346
>
4447
{/*
4548
This provider allows data passed to openDrawer to be accessed by drawer components.

static/app/components/globalDrawer/index.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
useRef,
77
useState,
88
} from 'react';
9+
import type {AnimationProps} from 'framer-motion';
910
import {AnimatePresence} from 'framer-motion';
1011

1112
import ErrorBoundary from 'sentry/components/errorBoundary';
@@ -46,6 +47,10 @@ export interface DrawerOptions {
4647
* other elements.
4748
*/
4849
shouldCloseOnInteractOutside?: (interactedElement: Element) => boolean;
50+
//
51+
// Custom framer motion transition for the drawer
52+
//
53+
transitionProps?: AnimationProps['transition'];
4954
}
5055

5156
interface DrawerRenderProps {
@@ -144,6 +149,7 @@ export function GlobalDrawer({children}) {
144149
onClose={handleClose}
145150
ref={panelRef}
146151
headerContent={currentDrawerConfig?.options?.headerContent ?? null}
152+
transitionProps={currentDrawerConfig?.options?.transitionProps}
147153
>
148154
{renderedChild}
149155
</DrawerComponents.DrawerPanel>

static/app/components/slideOverPanel.tsx

+11-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {forwardRef, useEffect} from 'react';
33
import isPropValid from '@emotion/is-prop-valid';
44
import {css} from '@emotion/react';
55
import styled from '@emotion/styled';
6-
import {motion} from 'framer-motion';
6+
import {type AnimationProps, motion} from 'framer-motion';
77

88
import {space} from 'sentry/styles/space';
99

@@ -26,12 +26,20 @@ type SlideOverPanelProps = {
2626
ariaLabel?: string;
2727
onOpen?: () => void;
2828
slidePosition?: 'right' | 'bottom';
29+
transitionProps?: AnimationProps['transition'];
2930
};
3031

3132
export default forwardRef(SlideOverPanel);
3233

3334
function SlideOverPanel(
34-
{ariaLabel, collapsed, children, onOpen, slidePosition}: SlideOverPanelProps,
35+
{
36+
ariaLabel,
37+
collapsed,
38+
children,
39+
onOpen,
40+
slidePosition,
41+
transitionProps = {},
42+
}: SlideOverPanelProps,
3543
ref: ForwardedRef<HTMLDivElement>
3644
) {
3745
useEffect(() => {
@@ -57,6 +65,7 @@ function SlideOverPanel(
5765
type: 'spring',
5866
stiffness: 500,
5967
damping: 50,
68+
...transitionProps,
6069
}}
6170
role="complementary"
6271
aria-hidden={collapsed}

static/app/views/issueDetails/streamline/foldSection.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const enum FoldSectionKey {
2929
EVIDENCE = 'evidence',
3030
MESSAGE = 'message',
3131

32-
// QuickTraceQuery?
32+
SUSPECT_ROOT_CAUSE = 'suspect-root-cause',
3333

3434
SPAN_EVIDENCE = 'span-evidence',
3535
HYDRATION_DIFF = 'hydration-diff',

0 commit comments

Comments
 (0)