Skip to content

Commit

Permalink
fix(Feature flags): use response.results when showing feature flags i…
Browse files Browse the repository at this point in the history
…n an infinite list (PostHog#26099)

Use response.results, if the groupType is feature flags, since the response value changed recently.
  • Loading branch information
Phanatic authored Nov 8, 2024
1 parent 7cfd244 commit e28af15
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,10 @@ export const infiniteListLogic = kea<infiniteListLogicType>([
const group = taxonomicGroups.find((g) => g.type === props.listGroupType)

if (group?.logic && group?.value) {
const items = group.logic.selectors[group.value]?.(state)
let items = group.logic.selectors[group.value]?.(state)
if (group?.value === 'featureFlags' && items.results) {
items = items.results
}
// TRICKY: Feature flags don't support dynamic behavioral cohorts,
// so we don't want to show them as selectable options in the taxonomic filter
// in the feature flag UI.
Expand All @@ -255,6 +258,7 @@ export const infiniteListLogic = kea<infiniteListLogicType>([
if (Array.isArray(items) && items.every((item) => 'filters' in item)) {
return filterOutBehavioralCohorts(items, props.hideBehavioralCohorts)
}

return items
}
if (group?.options) {
Expand Down
5 changes: 4 additions & 1 deletion posthog/api/web_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ def web_experiments(request: Request):
)

result = WebExperimentsAPISerializer(
WebExperiment.objects.filter(team_id=team.id).exclude(archived=True).select_related("feature_flag"),
WebExperiment.objects.filter(team_id=team.id)
.exclude(archived=True)
.exclude("end_date__isnull", False)
.select_related("feature_flag"),
many=True,
).data

Expand Down

0 comments on commit e28af15

Please sign in to comment.