Skip to content

feat(browser)!: Report web vitals for bfcache restores by default - #24325

Open
logaretm wants to merge 2 commits into
awad/soft-nav-framework-coveragefrom
awad/bfcache-web-vitals-default
Open

feat(browser)!: Report web vitals for bfcache restores by default#24325
logaretm wants to merge 2 commits into
awad/soft-nav-framework-coveragefrom
awad/bfcache-web-vitals-default

Conversation

@logaretm

@logaretm logaretm commented Sep 10, 2026

Copy link
Copy Markdown
Member

Renames webVitals.bfcache to webVitals.bfcacheNavigations and turns it on by default, so a back/forward-cache restore is measured like any other page view.

Also adds e2e tests for the bfcache web vital reporting.

@logaretm
logaretm added this pull request to stack #24274 September 10, 2026 18:55
Renames the `webVitals.bfcache` option to `bfcacheNavigations`, which reads as the sibling of
`softNavigations` that it is, and turns it on so a restore is measured like any other page
view. Neither the option nor its predecessor has appeared in a release, so nothing needs a
deprecation.

Restores stay a distinct population, tagged `browser.navigation.type: bfcache` so they can be
read apart from page load vitals rather than pooled with them.

Fixes the attribution while enabling it: the restore's navigation span was remembered by
matching on that same `bfcache` navigation type, which the restore's own web vital spans also
carry, so the first vital replaced the navigation span and every later one hung off a sibling
vital instead. In practice CLS, which is only finalized on pagehide, was parented to the LCP
span. The existing unit tests could not catch it because their mock navigation span had no op
to tell it apart from a vital span.
@logaretm
logaretm force-pushed the awad/bfcache-web-vitals-default branch from 9d5583d to 87ddc41 Compare September 10, 2026 19:00
@github-actions

github-actions Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.92 kB +0.41% +118 B 🔺
@sentry/browser - with treeshaking flags 27.21 kB +0.41% +109 B 🔺
@sentry/browser - with treeshaking flags tracing without tracing 27.11 kB +0.39% +103 B 🔺
@sentry/browser (incl. Tracing) 50.44 kB +2.49% +1.22 kB 🔺
@sentry/browser (incl. Tracing + Span Streaming) 50.45 kB +2.51% +1.23 kB 🔺
@sentry/browser (incl. Tracing, Profiling) 53.44 kB +2.52% +1.31 kB 🔺
@sentry/browser (incl. Tracing, Replay) 89.97 kB +1.37% +1.21 kB 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 79.09 kB +1.46% +1.14 kB 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 94.67 kB +1.32% +1.23 kB 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 107.68 kB +1.23% +1.31 kB 🔺
@sentry/browser (incl. Feedback) 46.41 kB +0.26% +116 B 🔺
@sentry/browser (incl. sendFeedback) 33.97 kB +0.31% +103 B 🔺
@sentry/browser (incl. FeedbackAsync) 39.08 kB +0.26% +101 B 🔺
@sentry/browser (incl. Metrics) 29.93 kB +0.38% +113 B 🔺
@sentry/browser (incl. Logs) 30.2 kB +0.37% +110 B 🔺
@sentry/browser (incl. Metrics & Logs) 30.87 kB +0.4% +121 B 🔺
@sentry/react 30.67 kB +0.4% +122 B 🔺
@sentry/react (incl. Tracing) 52.76 kB +2.33% +1.2 kB 🔺
@sentry/vue 36.16 kB +0.3% +108 B 🔺
@sentry/vue (incl. Tracing) 52.7 kB +2.39% +1.23 kB 🔺
@sentry/svelte 28.93 kB +0.35% +99 B 🔺
CDN Bundle 30.66 kB +0.35% +106 B 🔺
CDN Bundle (incl. Tracing) 50.96 kB +2.47% +1.23 kB 🔺
CDN Bundle (incl. Logs, Metrics) 32.93 kB +0.35% +113 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 52.94 kB +2.41% +1.24 kB 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 73.62 kB +0.2% +144 B 🔺
CDN Bundle (incl. Tracing, Replay) 88.52 kB +1.42% +1.23 kB 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 90.46 kB +1.44% +1.28 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 94.58 kB +1.47% +1.36 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 96.58 kB +1.44% +1.37 kB 🔺
CDN Bundle - uncompressed 90.73 kB +0.3% +270 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 152.24 kB +2.75% +4.07 kB 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 97.31 kB +0.29% +279 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 158.21 kB +2.65% +4.07 kB 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 226.72 kB +0.2% +430 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 271.81 kB +1.52% +4.05 kB 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 277.76 kB +1.49% +4.05 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 285.51 kB +1.44% +4.05 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 291.45 kB +1.42% +4.05 kB 🔺
@sentry/nextjs (client) 55.09 kB +2.02% +1.09 kB 🔺
@sentry/sveltekit (client) 50.86 kB +2.44% +1.21 kB 🔺
@sentry/core/server 37.08 kB +0.26% +96 B 🔺
@sentry/core/browser 13.66 kB +0.82% +110 B 🔺
@sentry/node 128.59 kB +0.63% +794 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 81.82 kB +0.26% +205 B 🔺
@sentry/node - without tracing 89.55 kB +0.95% +839 B 🔺
@sentry/node - without channel injection 107.52 kB +0.46% +489 B 🔺
@sentry/aws-serverless 97.77 kB +0.7% +677 B 🔺
@sentry/cloudflare (withSentry) - minified 203.02 kB +0.52% +1.04 kB 🔺
@sentry/cloudflare (withSentry) 505.43 kB +0.55% +2.76 kB 🔺

View base workflow run

A restore starts a navigation span like any other, and redirect detection folds a navigation
that follows another one closely into a child `navigation.redirect` span instead of a root
one. A soft navigation is driven by a click, which is the same signal redirect detection reads
as proof a navigation was user-initiated, so the two heuristics meet here.

They agree: the click keeps the soft navigation out of the redirect path. Verified by swapping
the click for a programmatic navigation of the same shape, which does get classified as a
redirect and fails the test, so it is not passing vacuously.
@logaretm

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 9e7c083. Configure here.

@logaretm
logaretm marked this pull request as ready for review September 10, 2026 19:53
@logaretm
logaretm requested a review from a team as a code owner September 10, 2026 19:53
@logaretm
logaretm requested review from Lms24 and msonnb and removed request for a team September 10, 2026 19:53
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