Skip to content

fix(browser): Rebase FP/FCP against activationStart for prerendered pages - #23032

Draft
logaretm wants to merge 1 commit into
developfrom
awad/prerender-fcp-fp-activationstart
Draft

fix(browser): Rebase FP/FCP against activationStart for prerendered pages#23032
logaretm wants to merge 1 commit into
developfrom
awad/prerender-fcp-fp-activationstart

Conversation

@logaretm

@logaretm logaretm commented Aug 4, 2026

Copy link
Copy Markdown
Member

Corrects First Paint and First Contentful Paint values on the pageload span for pages prerendered via the Speculation Rules API.

_trackFpFcp stored the raw paint entry.startTime as the fp/fcp measurement. When a page is prerendered and later activated, paint timestamps are relative to the prerender navigation start, so the value is inflated by the entire time the document sat dormant in the prerender buffer. LCP and TTFB already go through the vendored web-vitals library and are activation-corrected there, but FP/FCP took the raw paint path and had no correction anywhere.

I reproduced this in a real Chrome with an actual Speculation Rules prerender: activationStart came out at ~11300ms, the old code stored fcp=11352ms, and the fixed code reports 51ms, which is the real user-perceived paint time. The ~11.3s gap is exactly the buffer dwell time the old value was carrying.

…ages

`_trackFpFcp` stored the raw paint `entry.startTime` as the fp/fcp
measurement. For a page prerendered via the Speculation Rules API and
later activated, those timestamps are relative to the prerender
navigation start, so the reported value is inflated by the full time the
document sat dormant in the prerender buffer. Unlike LCP and TTFB (which
go through the vendored web-vitals library and are already corrected),
FP/FCP had no correction anywhere.

Rebase against `activationStart` and clamp at 0, matching the vendored
library's `Math.max(entry.startTime - getActivationStart(), 0)`.
`activationStart` is 0 for regular loads, so non-prerendered pages are
unchanged.
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 29.83 kB - -
@sentry/browser - with treeshaking flags 28.03 kB - -
@sentry/browser (incl. Tracing) 47.25 kB +0.02% +6 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 47.27 kB +0.01% +3 B 🔺
@sentry/browser (incl. Tracing, Profiling) 52 kB +0.01% +3 B 🔺
@sentry/browser (incl. Tracing, Replay) 86.6 kB +0.01% +6 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 76.01 kB +0.01% +4 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 91.29 kB +0.01% +6 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 103.96 kB +0.01% +5 B 🔺
@sentry/browser (incl. Feedback) 47.13 kB - -
@sentry/browser (incl. sendFeedback) 34.67 kB - -
@sentry/browser (incl. FeedbackAsync) 39.78 kB - -
@sentry/browser (incl. Metrics) 30.91 kB - -
@sentry/browser (incl. Logs) 31.14 kB - -
@sentry/browser (incl. Metrics & Logs) 31.81 kB - -
@sentry/react 31.63 kB - -
@sentry/react (incl. Tracing) 49.52 kB +0.02% +6 B 🔺
@sentry/vue 34.92 kB - -
@sentry/vue (incl. Tracing) 49.24 kB +0.01% +4 B 🔺
@sentry/svelte 29.86 kB - -
CDN Bundle 31.87 kB - -
CDN Bundle (incl. Tracing) 47.54 kB +0.01% +2 B 🔺
CDN Bundle (incl. Logs, Metrics) 33.41 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 48.95 kB +0.02% +6 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 72.75 kB - -
CDN Bundle (incl. Tracing, Replay) 85.19 kB +0.01% +5 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.51 kB +0.01% +6 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 91.02 kB +0.01% +5 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.32 kB +0.01% +6 B 🔺
CDN Bundle - uncompressed 94.62 kB - -
CDN Bundle (incl. Tracing) - uncompressed 142.13 kB +0.01% +11 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 99.24 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 146.11 kB +0.01% +11 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 223.94 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 261.39 kB +0.01% +11 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 265.35 kB +0.01% +11 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 275.09 kB +0.01% +11 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 279.05 kB +0.01% +11 B 🔺
@sentry/nextjs (client) 52.08 kB +0.01% +3 B 🔺
@sentry/sveltekit (client) 47.71 kB +0.01% +3 B 🔺
@sentry/core/server 65.52 kB - -
@sentry/core/browser 51.88 kB - -
@sentry/node 120.24 kB +0.01% +1 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 0 B added added
@sentry/node - without tracing 83.69 kB +0.01% +1 B 🔺
@sentry/aws-serverless 92.35 kB -0.01% -1 B 🔽
@sentry/cloudflare (withSentry) - minified 218.65 kB - -
@sentry/cloudflare (withSentry) 538.85 kB - -

View base workflow run

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.

1 participant