Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(browser-utils): Update web-vitals to v4.2.4 #14439

Merged
merged 11 commits into from
Dec 2, 2024

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Nov 22, 2024

This PR updates the vendored web-vitals library from 3.5.2 to 4.2.4
I haven't seen any changes of major concern for us but I think it makes a lot of sense to stay up to date. Especially considering that they seem to be working on a version 5.x already.

Some noteable web-vitals changes:

  • breaking type changes (version 4.0.0)
  • INP fixes and code refactors
  • minor LCP fix for web vitals library being late-initialized. I don't think this applies to us but who knows...

Further changes from our end:

  • The onHidden utility function was NOT updated to 4.2.4 due to the new version no longer triggering correctly for Safari 12.1-14.0 (which we still support). More details in the code comment
  • Added an optional param to getNavigationEntry since ww 4.2.4 only returns the entry if the responseStart time value is plausible. This is a good change for the library but since we also use the function to create other spans and attributes, I opted to leave things as they are for these use cases by passing in the flag to skip the plausibility check. This seems to be primarily a problem with Safari, which reports responseStart: 0 sometimes.
  • Continued to add checks for the existence of WINDOW.document which web-vitals assumes to be present
  • Continued to add longtask to the array of available types in the observe function

@Lms24 Lms24 self-assigned this Nov 22, 2024
Copy link
Contributor

github-actions bot commented Nov 22, 2024

size-limit report 📦

Path Size % Change Change
@sentry/browser 23.13 KB - -
@sentry/browser - with treeshaking flags 21.83 KB - -
@sentry/browser (incl. Tracing) 35.63 KB +0.29% +105 B 🔺
@sentry/browser (incl. Tracing, Replay) 72.53 KB +0.13% +93 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 62.91 KB +0.15% +95 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 76.85 KB +0.13% +95 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 89.31 KB +0.1% +91 B 🔺
@sentry/browser (incl. Feedback) 39.87 KB - -
@sentry/browser (incl. sendFeedback) 27.74 KB - -
@sentry/browser (incl. FeedbackAsync) 32.55 KB - -
@sentry/react 25.8 KB - -
@sentry/react (incl. Tracing) 38.46 KB +0.22% +85 B 🔺
@sentry/vue 27.28 KB - -
@sentry/vue (incl. Tracing) 37.41 KB +0.22% +82 B 🔺
@sentry/svelte 23.28 KB - -
CDN Bundle 24.32 KB - -
CDN Bundle (incl. Tracing) 37.29 KB +0.24% +90 B 🔺
CDN Bundle (incl. Tracing, Replay) 72.15 KB +0.1% +72 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 77.49 KB +0.11% +82 B 🔺
CDN Bundle - uncompressed 71.45 KB - -
CDN Bundle (incl. Tracing) - uncompressed 110.76 KB +0.24% +261 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 223.83 KB +0.12% +261 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 237.05 KB +0.11% +261 B 🔺
@sentry/nextjs (client) 38.77 KB +0.19% +74 B 🔺
@sentry/sveltekit (client) 36.14 KB +0.25% +91 B 🔺
@sentry/node 135.08 KB - -
@sentry/node - without tracing 97.14 KB - -
@sentry/aws-serverless 109.43 KB - -

View base workflow run

Copy link

codecov bot commented Nov 22, 2024

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
313 1 312 122
View the top 1 failed tests by shortest run time
tracing/metrics/web-vitals-ttfb/test.ts should capture TTFB vital.
Stack Traces | 9.34s run time
test.ts:7:11 should capture TTFB vital.

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

Comment on lines -35 to -37
// Used to store the interaction count after a bfcache restore, since p98
// interaction latencies should only consider the current navigation.
const prevInteractionCount = 0;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was extracted to the /lib/interaction.ts file

@Lms24 Lms24 force-pushed the lms/ref-update-web-vitals-lib branch from 2803e51 to fa8a690 Compare November 28, 2024 12:27
@Lms24 Lms24 marked this pull request as ready for review November 29, 2024 11:36
@Lms24 Lms24 force-pushed the lms/ref-update-web-vitals-lib branch from eb4eeb4 to e1eff2e Compare November 29, 2024 13:23
Copy link
Member

@s1gr1d s1gr1d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good :)

@Lms24 Lms24 merged commit 87b789c into develop Dec 2, 2024
120 checks passed
@Lms24 Lms24 deleted the lms/ref-update-web-vitals-lib branch December 2, 2024 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants