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

fix(experiments): show variant overrides in the sidebar view #25777

Merged
merged 4 commits into from
Oct 24, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export const SidePanelExperimentFeatureFlag = (): JSX.Element => {
const { experiment } = useValues(experimentLogic({ experimentId: experimentId ?? 'new' }))

const _featureFlagLogic = featureFlagLogic({ id: experiment.feature_flag?.id ?? null } as FeatureFlagLogicProps)
const { featureFlag, areVariantRolloutsValid, variantRolloutSum, featureFlagLoading } = useValues(_featureFlagLogic)
const { featureFlag, areVariantRolloutsValid, variantRolloutSum, featureFlagLoading, nonEmptyVariants } =
useValues(_featureFlagLogic)
const { setFeatureFlagFilters, saveSidebarExperimentFeatureFlag, distributeVariantsEqually } =
useActions(_featureFlagLogic)

Expand Down Expand Up @@ -143,6 +144,7 @@ export const SidePanelExperimentFeatureFlag = (): JSX.Element => {
id={`${experiment.feature_flag?.id}`}
filters={featureFlag?.filters ?? []}
onChange={setFeatureFlagFilters}
nonEmptyFeatureFlagVariants={nonEmptyVariants}
/>
<LemonDivider />
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export function FeatureFlagReleaseConditions({
filters,
onChange,
hideMatchOptions,
nonEmptyFeatureFlagVariants,
}: FeatureFlagReleaseConditionsLogicProps & {
hideMatchOptions?: boolean
isSuper?: boolean
Expand Down Expand Up @@ -78,6 +79,8 @@ export function FeatureFlagReleaseConditions({
const { cohortsById } = useValues(cohortsModel)
const { groupsAccessStatus } = useValues(groupsAccessLogic)

const featureFlagVariants = nonEmptyFeatureFlagVariants || nonEmptyVariants

const filterGroups: FeatureFlagGroupType[] = (isSuper ? filters?.super_groups : filters?.groups) || []
// :KLUDGE: Match by select only allows Select.Option as children, so render groups option directly rather than as a child
const matchByGroupsIntroductionOption = GroupsIntroductionOption()
Expand Down Expand Up @@ -335,7 +338,7 @@ export function FeatureFlagReleaseConditions({
</div>
</div>
)}
{nonEmptyVariants.length > 0 && (
{featureFlagVariants.length > 0 && (
<>
<LemonDivider className="my-3" />
{readOnly ? (
Expand All @@ -360,7 +363,7 @@ export function FeatureFlagReleaseConditions({
allowClear={true}
value={group.variant}
onChange={(value) => updateConditionSet(index, undefined, undefined, value)}
options={nonEmptyVariants.map((variant) => ({
options={featureFlagVariants.map((variant) => ({
label: variant.key,
value: variant.key,
}))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
FeatureFlagFilters,
FeatureFlagGroupType,
GroupTypeIndex,
MultivariateFlagVariant,
PropertyFilterType,
UserBlastRadiusType,
} from '~/types'
Expand All @@ -24,6 +25,7 @@ export interface FeatureFlagReleaseConditionsLogicProps {
id?: string
readOnly?: boolean
onChange?: (filters: FeatureFlagFilters, errors: any) => void
nonEmptyFeatureFlagVariants?: MultivariateFlagVariant[]
}

export const featureFlagReleaseConditionsLogic = kea<featureFlagReleaseConditionsLogicType>([
Expand Down
Loading