Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(issues-stacktrace): Add copy stacktrace button to ellipsis menu #82107

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MichaelSun48
Copy link
Member

@MichaelSun48 MichaelSun48 commented Dec 13, 2024

closes #55030

Adds a "Copy raw stacktrace" button to the ellipsis menu in the stacktrace section of an issue.

image

Does not work for native platforms - getting that to work is surprisingly complex and would definitely require a separate PR.

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Dec 13, 2024
@@ -1,20 +1,16 @@
import {Component, Fragment} from 'react';
Copy link
Member Author

Choose a reason for hiding this comment

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

This file is responsible for actually wrangling the stacktrace into the stacktrace string that's displayed when "Raw stacktrace" is selected. I have moved two methods, getContent and getAppleCrashreportEndpoint to the utils.tsx file to make for better reusability.

@@ -51,6 +60,28 @@ export function Exception({

const stackTraceNotFound = !(data.values ?? []).length;

const copyableStackTrace =
data.values && !isNative
Copy link
Member Author

Choose a reason for hiding this comment

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

native platforms appears to have a threaded stacktraces a lot of the time. If that's the case, this component is not even used. For the sake of simplicity, I've just excluded native platforms from this feature - implementing it for native will be significantly more complex since we may need to fetch crash reports (at least for Cocoa).

</Button>
</SectionedOverlayFooter>
)
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Ideally, the dropdown would close after this button was clicked, though I couldn't find a state-less way to achieve this. It's a small thing, but lmk if anyone knows if this is easily achievable without needing to take control over the open state of the menu.

@MichaelSun48 MichaelSun48 requested a review from a team December 13, 2024 22:49
@MichaelSun48 MichaelSun48 marked this pull request as ready for review December 13, 2024 22:49
Comment on lines +67 to +78
const {content} = getContent(
false,
exc,
'original',
projectSlug,
event.id,
api,
event.platform,
false,
false,
'',
organization
Copy link
Member

Choose a reason for hiding this comment

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

what is this madness

Copy link
Member Author

@MichaelSun48 MichaelSun48 Jan 3, 2025

Choose a reason for hiding this comment

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

this is the function to create the raw stacktrace string, and yes, it is insanely ugly and complex for some reason – I extracted this out of rawContent.tsx and put it into a separate utils.tsx folder so it could be re-used here to be copyable.

Comment on lines +55 to +67
export const getContent = (
isNative: boolean,
exc: any,
type: 'original' | 'minified',
projectSlug: string,
eventId: string,
api: Client,
platform?: PlatformKey,
loading?: boolean,
error?: boolean,
crashReport?: string,
organization?: Organization
) => {
Copy link
Member

Choose a reason for hiding this comment

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

there's probably something else we can do here. looks like we wanted both a component and to use the output

@getsantry
Copy link
Contributor

getsantry bot commented Jan 25, 2025

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry bot added Stale and removed Stale labels Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Copy" Button for Exception Text in the stack trace
2 participants