GoogleChrome / web-vitals

Essential metrics for a healthy site.
https://web.dev/vitals
Apache License 2.0
7.47k stars 410 forks source link

Fix `reportAllChanges` behavior for LCP when library is loaded late #468

Closed tunetheweb closed 4 months ago

tunetheweb commented 4 months ago

Currently if reportAllChanges=true but web-vitals is loaded late, then it doesn't report all LCP changes as we take the last one.

This can be confusing and make you think only one LCP entry was emitted when multiple ones were. It can be useful to know that multiple entries are emitted and this works for all the other metrics.

I also removed some "// Greater than the image load delay." comments that weren't true.

tunetheweb commented 4 months ago

Not sure what's gling on with the Firefox test. Unrelated to this PR and seems it's using v127.0a1 instead of v125.0.1 (the last successful run 2 days ago) so a dependency upgrade and seems to be ahead of stable now. Will keep digging...

tunetheweb commented 4 months ago

OK I think it's just a case of Firefox Nightly being a bit broken at the mo. Will try rerunning this tomorrow.