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: Swap to use dedicated version checker #24345

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
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
Binary file modified frontend/__snapshots__/exporter-exporter--dashboard--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions frontend/src/toolbar/elements/heatmapLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,11 @@ export const heatmapLogic = kea<heatmapLogicType>([
scrollDepthPosthogJsError: [
(s) => [s.posthog],
(posthog: PostHog): 'version' | 'disabled' | null => {
const posthogVersion =
posthog?._calculate_event_properties('test', {}, new Date())?.['$lib_version'] ?? '0.0.0'
// Later SDKs have the version in the posthog object, but we need to check for the old way of doing it too
const posthogVersion: string =
posthog.version ??
(posthog as any)?._calculate_event_properties?.('test', {}, new Date())?.['$lib_version'] ??
'0.0.0'
const majorMinorVersion = posthogVersion.split('.')
Copy link
Member

Choose a reason for hiding this comment

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

Minor point, but we could also replace this with the functions from semver (would be along the lines of compareVersion(a,b) >= 0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Given it is just a fallback I am going to be lazy and say no if thats alright 😅 but happy for you to take over and do it

Copy link
Member

Choose a reason for hiding this comment

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

I did this here #24484

const majorVersion = parseInt(majorMinorVersion[0], 10)
const minorVersion = parseInt(majorMinorVersion[1], 10)
Expand Down
Loading