Skip to content

Conversation

@BYK
Copy link
Member

@BYK BYK commented Jan 8, 2026

Problem

The WebVitalsDetail component crashes when navigating directly to a URL for an event that is not a valid pageload event with web vitals measurements.

Root Cause

The list view filters events with three conditions:

  1. event.measurements exists
  2. event?.contexts?.trace?.op === "pageload"
  3. event.measurements["score.total"] != null (after normalization)

The detail view only filtered by event_id, then accessed measurements["score.fcp"].value without null checks, causing a TypeError.

Solution

Add the same validation logic to WebVitalsDetail.tsx as exists in index.tsx:

  • Filter for measurements AND op === "pageload" in addition to event_id
  • Verify score.total exists after normalization
  • Invalid URLs now gracefully show "No measurement found" message instead of crashing

Add the same validation logic used in the list view to the detail view:
- Filter for events with measurements and op === 'pageload'
- Verify score.total exists after normalization
- Prevents crashes when navigating directly to invalid event URLs
@vercel
Copy link

vercel bot commented Jan 8, 2026

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

1 Skipped Deployment
Project Deployment Review Updated (UTC)
spotlightjs Skipped Skipped Jan 8, 2026 1:37am

@BYK BYK deployed to Preview January 8, 2026 01:32 — with GitHub Actions Active
Replace multiple array method passes (filter -> map -> filter -> forEach) with a single for loop that combines all validation and normalization logic. This improves performance and readability while maintaining the same functionality.
@BYK BYK deployed to Preview January 8, 2026 01:37 — with GitHub Actions Active
@BYK BYK marked this pull request as ready for review January 8, 2026 01:37
@BYK BYK enabled auto-merge (squash) January 8, 2026 01:37
@BYK BYK merged commit e1c05c4 into main Jan 8, 2026
20 checks passed
@BYK BYK deleted the fix/webvitals-detail-validation branch January 8, 2026 01:43
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