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: web vitals 3000 fallback #1404

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/extensions/web-vitals/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,10 @@ export class WebVitalsAutocapture {
if (!isUndefined(posthogExtensions)) {
;({ onLCP, onCLS, onFCP, onINP } = posthogExtensions.postHogWebVitalsCallbacks)
}

else if (assignableWindow.postHogWebVitalsCallbacks) {
Copy link
Member

Choose a reason for hiding this comment

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

hey @brunomguimaraes this shouldn't be necessary, what's the problem this solves?

Copy link
Member

Choose a reason for hiding this comment

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

Ugh, dang... It's because we load the latest web vitals extension into older clients. What a pain 😭

AFK right now will look at this properly when back

Copy link
Author

Choose a reason for hiding this comment

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

Exactly @pauldambra !
I've probably should've explain that better on the PR

Copy link
Member

Choose a reason for hiding this comment

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

:)

I should have caught it... have opened #1407 to try and work towards making this all safer

({ onLCP, onCLS, onFCP, onINP } = assignableWindow.postHogWebVitalsCallbacks);
}

if (!onLCP || !onCLS || !onFCP || !onINP) {
logger.error(LOGGER_PREFIX + 'web vitals callbacks not loaded - not starting')
return
Expand Down