Skip to content

Commit

Permalink
fix: make the version checker banner team aware (#24861)
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra authored and timgl committed Sep 10, 2024
1 parent bb122d1 commit 3fb562c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { useValues } from 'kea'
import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
import { teamLogic } from 'scenes/teamLogic'

import { versionCheckerLogic } from './versionCheckerLogic'

export function VersionCheckerBanner(): JSX.Element | null {
const { versionWarning } = useValues(versionCheckerLogic)
const { currentTeamId } = useValues(teamLogic)
const { versionWarning } = useValues(versionCheckerLogic({ teamId: currentTeamId }))
if (!versionWarning) {
return null
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { actions, afterMount, kea, listeners, path, reducers, sharedListeners } from 'kea'
import { actions, afterMount, kea, key, listeners, path, props, reducers, sharedListeners } from 'kea'
import { loaders } from 'kea-loaders'
import api from 'lib/api'
import { isNotNil } from 'lib/utils'
Expand Down Expand Up @@ -45,8 +45,14 @@ export interface AvailableVersions {
deprecation?: PosthogJSDeprecation
}

export interface VersionCheckerLogicProps {
teamId: number | null
}

export const versionCheckerLogic = kea<versionCheckerLogicType>([
path(['components', 'VersionChecker', 'versionCheckerLogic']),
props({ teamId: null } as VersionCheckerLogicProps),
key(({ teamId }) => teamId || 'no-team-id'),
path((key) => ['components', 'VersionChecker', 'versionCheckerLogic', key]),
actions({
setVersionWarning: (versionWarning: SDKVersionWarning | null) => ({ versionWarning }),
setSdkVersions: (sdkVersions: SDKVersion[]) => ({ sdkVersions }),
Expand Down

0 comments on commit 3fb562c

Please sign in to comment.