feat(browser)!: Report web vitals for bfcache restores by default - #24325
Open
logaretm wants to merge 2 commits into
Open
feat(browser)!: Report web vitals for bfcache restores by default#24325logaretm wants to merge 2 commits into
logaretm wants to merge 2 commits into
Conversation
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
force-pushed
the
awad/bfcache-web-vitals-default
branch
from
September 10, 2026 19:00
9d5583d to
87ddc41
Compare
Contributor
size-limit report 📦
|
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.
Member
Author
|
bugbot run |
There was a problem hiding this comment.
✅ 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
marked this pull request as ready for review
September 10, 2026 19:53
logaretm
requested review from
Lms24 and
msonnb
and removed request for
a team
September 10, 2026 19:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Renames
webVitals.bfcachetowebVitals.bfcacheNavigationsand 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.