Skip to content
This repository has been archived by the owner on Aug 13, 2023. It is now read-only.

Web-vitals package bumped from 2.0.0 to 3.0.1 #4641

Merged
merged 5 commits into from
Sep 8, 2022

Conversation

adamhouten
Copy link
Contributor

@adamhouten adamhouten commented Sep 6, 2022

Resolves https://github.com/bbc/web/issues/9062

Overall change: web-vitals package updated to 3.0.1 to take advantage of Google's experimental INP metric

Code changes:

See https://github.com/GoogleChrome/web-vitals/blob/main/CHANGELOG.md for more context to the changes

  • Swapped getCLS, getFID... etc to onCLS, onFID... as the get methods are now deprecated alias's of the on methods
  • The second argument in the on methods is now an options object rather than a boolean, recreated the previous functionality inonCLS and onLCP by settting the reportAllChanges field to true
  • Added the onINP method to expose the INP metric
  • Updated the tests to reflect the above changes

Changes affecting Existing Metrics Values

These only include changes that will affect the resulting metric data. Code changes are not mentioned below.

LCP

  • Only include last LCP entry in metric entries -
    • Previously all entries reported by the underlying Largest Contentful Paint API. However, some of those entries are not relevant to the current metric value so now only entries relevant to the metric value are stored.
    • Brings it inline with how other metrics are handled.
  • Only call report if LCP occurs before first hidden

Note to anyone reading this that this change doesn't affect the behavior of the library or what will be reported.
-
TTFB

  • Report TTFB after a bfcache restore
    • Metrics now captured when user goes back/forward to a page - these were not capture previously.
    • Brings it inline with how other metrics are handled.

  • (BBC contributors only) This PR follows the repository use guidelines
  • I have assigned myself to this PR and the corresponding issues
  • Automated jest tests added (for new features) or updated (for existing features)
  • This PR requires manual testing

@adamhouten adamhouten marked this pull request as ready for review September 7, 2022 07:28
@andrewscfc andrewscfc merged commit 27c5560 into BBC-archive:latest Sep 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants