fix(browser): Rebase FP/FCP against activationStart for prerendered pages - #23032
Draft
logaretm wants to merge 1 commit into
Draft
fix(browser): Rebase FP/FCP against activationStart for prerendered pages#23032logaretm wants to merge 1 commit into
logaretm wants to merge 1 commit into
Conversation
…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.
Contributor
size-limit report 📦
|
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.
Corrects First Paint and First Contentful Paint values on the pageload span for pages prerendered via the Speculation Rules API.
_trackFpFcpstored the raw paintentry.startTimeas 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.