Skip to content

Commit

Permalink
refactor: rename logic file to be more generic
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Borcsik committed Oct 8, 2024
1 parent da5211c commit 8d217ae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { SESSION_REPLAY_MINIMUM_DURATION_OPTIONS } from 'lib/constants'
import { IconCancel, IconSelectEvents } from 'lib/lemon-ui/icons'
import { LemonLabel } from 'lib/lemon-ui/LemonLabel/LemonLabel'
import { objectsEqual } from 'lib/utils'
import { sessionReplayLinkedFlagLogic } from 'scenes/settings/environment/sessionReplayLinkedFlagLogic'
import { sessionReplayIngestionControlLogic } from 'scenes/settings/environment/sessionReplayIngestionControlLogic'
import { teamLogic } from 'scenes/teamLogic'
import { userLogic } from 'scenes/userLogic'

Expand Down Expand Up @@ -259,7 +259,9 @@ function LinkedFlagSelector(): JSX.Element | null {

const featureFlagRecordingFeatureEnabled = hasAvailableFeature(AvailableFeature.REPLAY_FEATURE_FLAG_BASED_RECORDING)

const logic = sessionReplayLinkedFlagLogic({ id: currentTeam?.session_recording_linked_flag?.id || null })
const logic = sessionReplayIngestionControlLogic({
linkedFeatureFlagId: currentTeam?.session_recording_linked_flag?.id || null,
})
const { linkedFlag, featureFlagLoading, flagHasVariants } = useValues(logic)
const { selectFeatureFlag } = useActions(logic)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import { teamLogic } from 'scenes/teamLogic'

import { FeatureFlagBasicType } from '~/types'

import type { sessionReplayLinkedFlagLogicType } from './sessionReplayLinkedFlagLogicType'
import type { sessionReplayIngestionControlLogicType } from './sessionReplayIngestionControlLogicType'

export interface ReplayLinkedFlagLogicProps {
id: number | null
export interface ReplayIngestionControlLogicProps {
linkedFeatureFlagId: number | null
}

export const sessionReplayLinkedFlagLogic = kea<sessionReplayLinkedFlagLogicType>([
path(['scenes', 'settings', 'project', 'sessionReplayLinkedFlagLogic']),
export const sessionReplayIngestionControlLogic = kea<sessionReplayIngestionControlLogicType>([
path(['scenes', 'settings', 'project', 'sessionReplayIngestionControlLogic']),
actions({
selectFeatureFlag: (flag: FeatureFlagBasicType) => ({ flag }),
}),
Expand All @@ -27,12 +27,12 @@ export const sessionReplayLinkedFlagLogic = kea<sessionReplayLinkedFlagLogicType
},
],
}),
props({} as ReplayLinkedFlagLogicProps),
props({} as ReplayIngestionControlLogicProps),
loaders(({ props }) => ({
featureFlag: {
loadFeatureFlag: async () => {
if (props.id) {
const retrievedFlag = await api.featureFlags.get(props.id)
if (props.linkedFeatureFlagId) {
const retrievedFlag = await api.featureFlags.get(props.linkedFeatureFlagId)
return variantKeyToIndexFeatureFlagPayloads(retrievedFlag)
}
return null
Expand Down

0 comments on commit 8d217ae

Please sign in to comment.