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

[DT-340] Add stack trace on expanded event details #1128

Conversation

laurakwhit
Copy link
Contributor

What was changed

Conditionally renders a Stack trace code block next to the Failure block on expanded event details if there is a stackTrace property.

Example 1 Example 2
Screenshot 2023-02-09 at 11 48 23 AM Screenshot 2023-02-09 at 11 48 53 AM

Why?

Easier to view the stack trace for debugging.

Checklist

  1. Closes: DT-340

  2. How was this tested:

  • Verify there is a Stack trace block if there is a Failure on an event with a stackTrace property
  • Verify the event row with a Stack trace block is responsive
  • Verify there is not a Stack trace block if there is a Failure on an event without a stackTrace property
  1. Any docs updates needed? n/a

@laurakwhit laurakwhit requested a review from a team as a code owner February 9, 2023 18:51
@vercel
Copy link

vercel bot commented Feb 9, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
holocene ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 10, 2023 at 5:50PM (UTC)
ui ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 10, 2023 at 5:50PM (UTC)

@stevekinney
Copy link
Member

Should we make those equal height? /cc @canvanooo

@@ -25,15 +25,27 @@
export let inline = false;

const { workflow, namespace } = $page.params;
$: codeBlockValue = getCodeBlockValue(value);
$: stackTrace =
codeBlockValue?.stackTrace || codeBlockValue?.cause?.stackTrace;
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if it makes sense to just recursively iterate down the object and look for a stackTrace?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could do that instead! I was hoping we could avoid that as it looks like there aren't that many places it could be, but I definitely could have missed some possibilities 😅

>
<div>
<p class="text-sm">{format(key)}</p>
<CodeBlock content={codeBlockValue} class="h-auto" {inline} />
Copy link
Member

Choose a reason for hiding this comment

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

Hot take: Should we move this logic into the CodeBlock itself? And then the CodeBlock looks at the JSON and figures out if it should recursively add another CodeBlock. The advantage here would be that it would Just Work™ anywhere code blocks are found.

Choose a reason for hiding this comment

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

Should we make those equal height? /cc @canvanooo

@stevekinney yes good call out, same height would look better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I opted for keeping this logic here as I think we probably want to keep CodeBlock as agnostic as possible. Open to discussion around how data dependent we want our Holocene components to be though!

I'm also not sure if we will always want that second code block (e.g. if the CodeBlock is inline).

@laurakwhit laurakwhit merged commit 7859fd2 into main Feb 28, 2023
@laurakwhit laurakwhit deleted the DT-340-Add-split-view-for-code-blocks-when-a-stackTrace-is-present branch February 28, 2023 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants