Description
Summary
Upgrading to web-vitals version 4.0.0 would help with INP metrics.
Currently, INP metrics can be reported with a 'blank' eventTarget.
(Web vitals reports INP on hide/unmount of the page, by then the element contributing to the largest INP might have been removed).
Web vitals v4.0.0 includes code to track these elements and is able to report the element's name even when the element is removed.
See: https://github.com/GoogleChrome/web-vitals/blob/v4.0.1/CHANGELOG.md?plain=1#L18 /GoogleChrome/web-vitals#477.
Desired Behavior
Use web-vitals v4.0.0 to report INP eventTarget.
Possible Solution
Update to v4.0.0.
(Current lock file value is 3.5.1: https://github.com/newrelic/newrelic-browser-agent/blob/v1.260.1/package-lock.json#L23210)
Also, 3.5.2 appears to contain a mitigation for this issue as well. (See: https://github.com/GoogleChrome/web-vitals/blob/v4.0.1/CHANGELOG.md?plain=1#L24)
- Maybe update to 3.5.2 while evaluating 4.0.0.
Additional context
Note: v4.0.0 contains breaking changes to the metric format which would require either:
- A breaking change in the PageViewTiming name for NewRelic users
- Transforming the metric to continue to use the older/existing names.
(Other breaking changes are noted in the release notes)