Skip to content

Commit

Permalink
fix: Contexts inside Trace detail is breaking in case of no child tra…
Browse files Browse the repository at this point in the history
…nsactions. (#600)
  • Loading branch information
Shubhdeep12 authored Dec 2, 2024
1 parent 730684c commit 12ab0a7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
6 changes: 6 additions & 0 deletions .changeset/poor-buckets-explode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@spotlightjs/overlay': patch
---

- Fixed trace context page in case of no transaction events.
- Fixed import of vitePreprocess in astro-playground
2 changes: 1 addition & 1 deletion demos/astro-playground/svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import { vitePreprocess } from '@astrojs/svelte';

export default {
preprocess: vitePreprocess(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,20 @@ const EXAMPLE_CONTEXT = `Sentry.setContext("character", {
attack_type: "melee",
});`;

const exampleContext = (
<div className="space-y-4 px-6 py-4">
<div className="text-primary-300">
No context available for this event. Try adding some to make debugging easier.
</div>
<pre className="whitespace-pre-wrap">{EXAMPLE_CONTEXT}</pre>
</div>
);

export default function EventContexts({ event }: { event: SentryEvent }) {
if (!event) {
return exampleContext;
}

const contexts: Record<string, Nullable<Record<string, unknown>>> = {
request: event.request,
...event.contexts,
Expand All @@ -25,14 +38,7 @@ export default function EventContexts({ event }: { event: SentryEvent }) {
const { tags } = event;

if (contextEntries.length === 0 && !tags) {
return (
<div className="space-y-4 px-6 py-4">
<div className="text-primary-300">
No context available for this event. Try adding some to make debugging easier.
</div>
<pre className="whitespace-pre-wrap ">{EXAMPLE_CONTEXT}</pre>
</div>
);
return exampleContext;
}

return (
Expand Down

0 comments on commit 12ab0a7

Please sign in to comment.