Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import type {PlatformKey} from 'sentry/types/project';
import {StackType, StackView} from 'sentry/types/stacktrace';
import {defined} from 'sentry/utils';
import {isNativePlatform} from 'sentry/utils/platform';
import {useHasStreamlinedUI} from 'sentry/views/issueDetails/utils';

type Props = {
chainedException: boolean;
Expand Down Expand Up @@ -44,7 +43,6 @@ export function StackTrace({
frameSourceMapDebuggerData,
stackType,
}: Props) {
const hasStreamlinedUI = useHasStreamlinedUI();
if (!defined(stacktrace)) {
return null;
}
Expand Down Expand Up @@ -90,7 +88,6 @@ export function StackTrace({
newestFirst={newestFirst}
event={event}
meta={meta}
hideIcon={hasStreamlinedUI}
/>
);
}
Expand All @@ -107,7 +104,6 @@ export function StackTrace({
threadId={threadId}
frameSourceMapDebuggerData={frameSourceMapDebuggerData}
hideSourceMapDebugger={stackType === StackType.MINIFIED}
hideIcon={hasStreamlinedUI}
/>
);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {EventFixture} from 'sentry-fixture/event';
import {EventEntryStacktraceFixture} from 'sentry-fixture/eventEntryStacktrace';
import {EventStacktraceFrameFixture} from 'sentry-fixture/eventStacktraceFrame';
import {GitHubIntegrationFixture} from 'sentry-fixture/githubIntegration';
import {OrganizationFixture} from 'sentry-fixture/organization';
import {ProjectFixture} from 'sentry-fixture/project';
Expand Down Expand Up @@ -63,9 +62,6 @@ describe('StackTrace', () => {
const stackTraceContent = screen.getByTestId('stack-trace-content');
expect(stackTraceContent).toBeInTheDocument();

// platform icon
expect(screen.getByTestId('platform-icon-python')).toBeInTheDocument();

// frame list
const frames = screen.getByTestId('frames');
expect(frames.children).toHaveLength(5);
Expand Down Expand Up @@ -453,94 +449,4 @@ describe('StackTrace', () => {
expect(frameTitles[1]).toHaveTextContent('raven/base.py in build_msg at line 303');
});
});

describe('platform icons', () => {
it('uses the top in-app frame file extension for mixed stack trace platforms', () => {
render(
<StackTraceContent
{...defaultProps}
data={{
...data,
frames: [
EventStacktraceFrameFixture({
inApp: true,
filename: 'foo.cs',
}),
EventStacktraceFrameFixture({
inApp: true,
filename: 'foo.py',
}),
EventStacktraceFrameFixture({
inApp: true,
filename: 'foo',
}),
EventStacktraceFrameFixture({
inApp: false,
filename: 'foo.rb',
}),
],
}}
event={event}
/>
);

// foo.py is the most recent in-app frame with a valid file extension
expect(screen.getByTestId('platform-icon-python')).toBeInTheDocument();
});

it('uses frame.platform if file extension does not work', () => {
render(
<StackTraceContent
{...defaultProps}
data={{
...data,
frames: [
EventStacktraceFrameFixture({
inApp: true,
filename: 'foo.cs',
}),
EventStacktraceFrameFixture({
inApp: true,
filename: 'foo',
platform: 'node',
}),
EventStacktraceFrameFixture({
inApp: true,
filename: 'foo',
}),
EventStacktraceFrameFixture({
inApp: false,
filename: 'foo.rb',
}),
],
}}
event={event}
/>
);

expect(screen.getByTestId('platform-icon-node')).toBeInTheDocument();
});

it('falls back to the event platform if there is no other information', () => {
render(
<StackTraceContent
{...defaultProps}
data={{
...data,
frames: [
EventStacktraceFrameFixture({
inApp: true,
filename: 'foo',
platform: null,
}),
],
}}
platform="python"
event={event}
/>
);

expect(screen.getByTestId('platform-icon-python')).toBeInTheDocument();
});
});
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {Fragment, useState} from 'react';
import {css} from '@emotion/react';
import styled from '@emotion/styled';

import type {DeprecatedLineProps} from 'sentry/components/events/interfaces/frame/deprecatedLine';
Expand All @@ -9,7 +8,6 @@ import {
getHiddenFrameIndices,
getLastFrameIndex,
isRepeatedFrame,
stackTracePlatformIcon,
} from 'sentry/components/events/interfaces/utils';
import {Panel} from 'sentry/components/panels/panel';
import type {Event, Frame} from 'sentry/types/event';
Expand All @@ -18,7 +16,6 @@ import type {StackTraceMechanism, StacktraceType} from 'sentry/types/stacktrace'
import {defined} from 'sentry/utils';

import {OmittedFrames} from './omittedFrames';
import {StacktracePlatformIcon} from './platformIcon';

type DefaultProps = {
expandFirstFrame: boolean;
Expand All @@ -32,7 +29,6 @@ type Props = {
platform: PlatformKey;
className?: string;
frameSourceMapDebuggerData?: FrameSourceMapDebuggerData[];
hideIcon?: boolean;
hideSourceMapDebugger?: boolean;
isHoverPreviewed?: boolean;
lockAddress?: string;
Expand All @@ -53,7 +49,6 @@ export function Content({
isHoverPreviewed = false,
maxDepth,
meta,
hideIcon,
threadId,
lockAddress,
frameSourceMapDebuggerData,
Expand Down Expand Up @@ -202,15 +197,11 @@ export function Content({
includeSystemFrames ? 'full-traceback' : 'in-app-traceback'
}`;

const platformIcon = stackTracePlatformIcon(platform, data.frames ?? []);

return (
<Wrapper>
{hideIcon ? null : <StacktracePlatformIcon platform={platformIcon} />}
<StackTraceContentPanel
className={wrapperClassName}
data-test-id="stack-trace-content"
hideIcon={hideIcon}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrapper components now serve no purpose after icon removal

Low Severity

The Wrapper styled component in both content.tsx and nativeContent.tsx existed solely to provide a position: relative containing block for the absolutely-positioned StacktracePlatformIcon. Now that the icon is removed, Wrapper is an unnecessary DOM node — Panel (which ContentPanel/StackTraceContentPanel extends) already has position: relative. Since this is a cleanup PR, these leftover wrappers are a natural candidate for removal.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f7af708. Configure here.

>
<StyledList data-test-id="frames">
{newestFirst ? [...convertedFrames].reverse() : convertedFrames}
Expand All @@ -224,18 +215,9 @@ const Wrapper = styled('div')`
position: relative;
`;

export const StackTraceContentPanel = styled(Panel)<{hideIcon?: boolean}>`
export const StackTraceContentPanel = styled(Panel)`
position: relative;
overflow: hidden;

${p =>
!p.hideIcon &&
css`
border-top-left-radius: 0;
@media (max-width: ${p.theme.breakpoints.md}) {
border-top-left-radius: ${p.theme.radius.md};
}
`}
`;

const StyledList = styled('ul')`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import type {PlatformKey} from 'sentry/types/project';
import type {StacktraceType} from 'sentry/types/stacktrace';
import {StackView} from 'sentry/types/stacktrace';
import {isNativePlatform} from 'sentry/utils/platform';
import {useHasStreamlinedUI} from 'sentry/views/issueDetails/utils';

import {Content} from './content';
import {NativeContent} from './nativeContent';
Expand Down Expand Up @@ -39,7 +38,6 @@ export function StackTraceContent({
threadId,
lockAddress,
}: Props) {
const hasStreamlinedUI = useHasStreamlinedUI();
if (stackView === StackView.RAW) {
return (
<ErrorBoundary mini>
Expand All @@ -62,7 +60,6 @@ export function StackTraceContent({
groupingCurrentLevel={groupingCurrentLevel}
meta={meta}
inlined={inlined}
hideIcon={inlined || hasStreamlinedUI}
maxDepth={maxDepth}
/>
</ErrorBoundary>
Expand All @@ -79,7 +76,6 @@ export function StackTraceContent({
event={event}
newestFirst={newestFirst}
meta={meta}
hideIcon={inlined || hasStreamlinedUI}
inlined={inlined}
maxDepth={maxDepth}
threadId={threadId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
getLastFrameIndex,
isRepeatedFrame,
parseAddress,
stackTracePlatformIcon,
} from 'sentry/components/events/interfaces/utils';
import {Panel} from 'sentry/components/panels/panel';
import type {Event, Frame} from 'sentry/types/event';
Expand All @@ -18,7 +17,6 @@ import type {StacktraceType} from 'sentry/types/stacktrace';
import {defined} from 'sentry/utils';

import {OmittedFrames} from './omittedFrames';
import {StacktracePlatformIcon} from './platformIcon';

function isFrameUsedForGrouping(
frame: Frame,
Expand All @@ -40,7 +38,6 @@ type Props = {
platform: PlatformKey;
className?: string;
groupingCurrentLevel?: Group['metadata']['current_level'];
hideIcon?: boolean;
includeSystemFrames?: boolean;
inlined?: boolean;
isHoverPreviewed?: boolean;
Expand All @@ -56,7 +53,6 @@ export function NativeContent({
newestFirst,
isHoverPreviewed,
inlined,
hideIcon,
groupingCurrentLevel,
includeSystemFrames = true,
maxDepth,
Expand Down Expand Up @@ -241,15 +237,9 @@ export function NativeContent({

return (
<Wrapper>
{hideIcon ? null : (
<StacktracePlatformIcon
platform={stackTracePlatformIcon(platform, data.frames ?? [])}
/>
)}
<ContentPanel
className={wrapperClassName}
data-test-id="native-stack-trace-content"
hideIcon={hideIcon}
>
<Frames data-test-id="stack-trace">{convertedFrames}</Frames>
</ContentPanel>
Expand All @@ -261,9 +251,8 @@ const Wrapper = styled('div')`
position: relative;
`;

const ContentPanel = styled(Panel)<{hideIcon?: boolean}>`
const ContentPanel = styled(Panel)`
position: relative;
border-top-left-radius: ${p => (p.hideIcon ? p.theme.radius.md : 0)};
overflow: hidden;
`;

Expand Down

This file was deleted.

5 changes: 1 addition & 4 deletions static/app/components/events/interfaces/exception.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {EntryType} from 'sentry/types/event';
import type {Group} from 'sentry/types/group';
import type {Project} from 'sentry/types/project';
import {SectionDivider} from 'sentry/views/issueDetails/streamline/foldSection';
import {useHasStreamlinedUI} from 'sentry/views/issueDetails/utils';

import {ExceptionContent} from './crashContent/exception';
import {NoStackTraceMessage} from './noStackTraceMessage';
Expand All @@ -33,8 +32,6 @@ export function Exception({
groupingCurrentLevel,
}: Props) {
const eventHasThreads = !!event.entries.some(entry => entry.type === EntryType.THREADS);
const hasStreamlinedUI = useHasStreamlinedUI();

// in case there are threads in the event data, we don't render the
// exception block. Instead the exception is contained within the
// thread interface.
Expand Down Expand Up @@ -106,7 +103,7 @@ export function Exception({
groupingCurrentLevel={groupingCurrentLevel}
meta={meta}
/>
{hasStreamlinedUI && group && (
{group && (
<Fragment>
{data.values && data.values.length > 1 && (
<SectionDivider orientation="horizontal" />
Expand Down
Loading
Loading