Skip to content

[trace-viewer] cleanup #1870

Closed
mitul-s wants to merge 63 commits intomainfrom
ms/trace-cleanup
Closed

[trace-viewer] cleanup #1870
mitul-s wants to merge 63 commits intomainfrom
ms/trace-cleanup

Conversation

@mitul-s
Copy link
Copy Markdown
Contributor

@mitul-s mitul-s commented Apr 29, 2026

  • marker lines
  • taller spans
  • moved zoom controls to bottom right
  • arrows to indicate span location
  • spacing

mitul-s and others added 30 commits March 19, 2026 14:42
…ent` receives `undefined` (cast as `Trace`) and immediately accesses `trace.spans`, causing "Cannot read properties of undefined".

This commit fixes the issue reported at packages/web-shared/src/components/trace-viewer-new.tsx:28

**Bug Analysis:**

In `trace-viewer-new.tsx`, the `buildTrace` function returns `undefined` when `!run?.runId`. The result is stored in `trace` which has type `TraceWithMeta | undefined`. However, on line 28, `trace` is passed directly to `NewTraceViewerComponent` with a type assertion `trace as Trace`, which silences the TypeScript error but does not prevent the runtime crash.

Inside `NewTraceViewerComponent` (in `new-trace-viewer/trace-viewer.tsx` line 98), the component immediately accesses `trace.spans`:

```tsx
<ActiveSpanProvider spans={trace.spans}>
```

When `trace` is `undefined`, this produces: `TypeError: Cannot read properties of undefined (reading 'spans')`.

This happens whenever the component renders before `run.runId` is available — a normal scenario during initial loading.

The old `WorkflowTraceViewer` component (in `workflow-trace-view.tsx` line 953) correctly handles this with a `if (!trace)` guard that renders a loading skeleton. The new component lacks this guard.

**Fix:**

Added a null guard in `trace-viewer-new.tsx` that checks `if (!trace)` before rendering `NewTraceViewerComponent`. When trace is undefined, a simple loading placeholder is rendered instead. This prevents the crash and follows the same pattern as the existing `WorkflowTraceViewer`. The `as Trace` cast on line 28 is now safe because `trace` is guaranteed to be defined after the guard.


Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: mitul-s <mitulxshah@gmail.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview, Comment Apr 29, 2026 9:23pm
example-nextjs-workflow-webpack Ready Ready Preview, Comment Apr 29, 2026 9:23pm
example-workflow Ready Ready Preview, Comment Apr 29, 2026 9:23pm
workbench-astro-workflow Ready Ready Preview, Comment Apr 29, 2026 9:23pm
workbench-express-workflow Ready Ready Preview, Comment Apr 29, 2026 9:23pm
workbench-fastify-workflow Ready Ready Preview, Comment Apr 29, 2026 9:23pm
workbench-hono-workflow Ready Ready Preview, Comment Apr 29, 2026 9:23pm
workbench-nitro-workflow Ready Ready Preview, Comment Apr 29, 2026 9:23pm
workbench-nuxt-workflow Ready Ready Preview, Comment Apr 29, 2026 9:23pm
workbench-sveltekit-workflow Ready Ready Preview, Comment Apr 29, 2026 9:23pm
workbench-vite-workflow Ready Ready Preview, Comment Apr 29, 2026 9:23pm
workflow-docs Ready Ready Preview, Comment, Open in v0 Apr 29, 2026 9:23pm
workflow-swc-playground Ready Ready Preview, Comment Apr 29, 2026 9:23pm
workflow-web Ready Ready Preview, Comment Apr 29, 2026 9:23pm

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 29, 2026

⚠️ No Changeset found

Latest commit: 69af636

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 29, 2026

🧪 E2E Test Results

All tests passed

Summary

Passed Failed Skipped Total
✅ ▲ Vercel Production 978 0 67 1045
✅ 💻 Local Development 1054 0 86 1140
✅ 📦 Local Production 1054 0 86 1140
✅ 🐘 Local Postgres 1054 0 86 1140
✅ 🪟 Windows 95 0 0 95
✅ 📋 Other 267 0 18 285
Total 4502 0 343 4845

Details by Category

✅ ▲ Vercel Production
App Passed Failed Skipped
✅ astro 88 0 7
✅ example 88 0 7
✅ express 88 0 7
✅ fastify 88 0 7
✅ hono 88 0 7
✅ nextjs-turbopack 93 0 2
✅ nextjs-webpack 93 0 2
✅ nitro 88 0 7
✅ nuxt 88 0 7
✅ sveltekit 88 0 7
✅ vite 88 0 7
✅ 💻 Local Development
App Passed Failed Skipped
✅ astro-stable 89 0 6
✅ express-stable 89 0 6
✅ fastify-stable 89 0 6
✅ hono-stable 89 0 6
✅ nextjs-turbopack-canary 76 0 19
✅ nextjs-turbopack-stable 95 0 0
✅ nextjs-webpack-canary 76 0 19
✅ nextjs-webpack-stable 95 0 0
✅ nitro-stable 89 0 6
✅ nuxt-stable 89 0 6
✅ sveltekit-stable 89 0 6
✅ vite-stable 89 0 6
✅ 📦 Local Production
App Passed Failed Skipped
✅ astro-stable 89 0 6
✅ express-stable 89 0 6
✅ fastify-stable 89 0 6
✅ hono-stable 89 0 6
✅ nextjs-turbopack-canary 76 0 19
✅ nextjs-turbopack-stable 95 0 0
✅ nextjs-webpack-canary 76 0 19
✅ nextjs-webpack-stable 95 0 0
✅ nitro-stable 89 0 6
✅ nuxt-stable 89 0 6
✅ sveltekit-stable 89 0 6
✅ vite-stable 89 0 6
✅ 🐘 Local Postgres
App Passed Failed Skipped
✅ astro-stable 89 0 6
✅ express-stable 89 0 6
✅ fastify-stable 89 0 6
✅ hono-stable 89 0 6
✅ nextjs-turbopack-canary 76 0 19
✅ nextjs-turbopack-stable 95 0 0
✅ nextjs-webpack-canary 76 0 19
✅ nextjs-webpack-stable 95 0 0
✅ nitro-stable 89 0 6
✅ nuxt-stable 89 0 6
✅ sveltekit-stable 89 0 6
✅ vite-stable 89 0 6
✅ 🪟 Windows
App Passed Failed Skipped
✅ nextjs-turbopack 95 0 0
✅ 📋 Other
App Passed Failed Skipped
✅ e2e-local-dev-nest-stable 89 0 6
✅ e2e-local-postgres-nest-stable 89 0 6
✅ e2e-local-prod-nest-stable 89 0 6

📋 View full workflow run

Copy link
Copy Markdown
Contributor

@vercel vercel Bot left a comment

Choose a reason for hiding this comment

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

Additional Suggestion:

Build fails due to unused imports (computeCompressedTimeMarkers, computeTimeMarkers) and missing TimeMarker type import in timeline.tsx

Fix on Vercel

@mitul-s mitul-s force-pushed the ms/trace-viewer-2 branch from 6138b78 to b5b48f0 Compare April 30, 2026 15:46
Base automatically changed from ms/trace-viewer-2 to main April 30, 2026 17:46
@mitul-s
Copy link
Copy Markdown
Contributor Author

mitul-s commented Apr 30, 2026

fixed in #1872

@mitul-s mitul-s closed this Apr 30, 2026
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.

2 participants