feat(browser): Report web vitals for bfcache restores - #23750
Conversation
c306449 to
b172bce
Compare
size-limit report 📦
|
b172bce to
89498ab
Compare
89498ab to
00a507c
Compare
00a507c to
9e62164
Compare
9e62164 to
2bfb452
Compare
2bfb452 to
aabc750
Compare
aabc750 to
1689dad
Compare
1689dad to
7e70c6c
Compare
7e70c6c to
af8c52d
Compare
af8c52d to
9cff25a
Compare
9cff25a to
35ba3f5
Compare
35ba3f5 to
b201558
Compare
b201558 to
dffc394
Compare
dffc394 to
bd52ab7
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit dffc394. Configure here.
|
|
||
| if (reportBfcache) { | ||
| enableBfcacheReporting(); | ||
| } |
There was a problem hiding this comment.
Bfcache opt-in runs too late
Medium Severity
enableBfcacheReporting is only called from webVitalsIntegration setup, but that integration is auto-registered in browserTracingIntegration afterAllSetup. Replay can instrument observers first and pin reportAllChanges on, so incremental LCP and CLS updates each emit a span on the per-navigation path.
Reviewed by Cursor Bugbot for commit dffc394. Configure here.
bd52ab7 to
85494a6
Compare
… dropped
`withoutBfcache` dropped every metric web-vitals reported after a
back/forward-cache restore. That was the right call while there was
nothing to attach them to: a restore reuses the frozen document, so the
values would have landed on the span the page had before it was frozen.
Now that a restore gets its own navigation span, they have a correct
parent, so the drop becomes an option rather than a hard rule:
webVitals: { bfcache: true }
Off by default. A restore is near-instant, so its vitals are a different
population from page load vitals, and the earlier concern about skewing
aggregates still applies to anyone who has not decided how to treat them.
`browser.navigation.type: bfcache` makes them separable once enabled.
Reporting per navigation rather than per page load is now what the
tracker flag means, since bfcache restores need it for the same reason
soft navigations do. `reportAllChanges` is switched off for either, since
the per-navigation path relies on each reported value already being final
for its navigation.
Verified end to end in Chrome 152: a restore emits LCP and CLS parented
to the bfcache navigation span on the restore's own trace, and a
bfcache-ineligible back navigation still falls back to a page load.
85494a6 to
b6e2c34
Compare


Reports web vitals for back/forward cache restores, which we dropped outright before.
Now that a restore gets its own navigation span in #23748, the vitals have a correct parent, so the hardcoded
withoutBfcachedrop becomeswebVitals: { bfcache: true }. Off by default, since a restore is a different population from a page load.Stacked on #23748.