Skip to content

Commit

Permalink
fix(retention): fix retention actors with dashboard overrides (#26503)
Browse files Browse the repository at this point in the history
  • Loading branch information
thmsobrmlr authored Nov 29, 2024
1 parent afd0e15 commit 4db9b9f
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 26 deletions.
110 changes: 90 additions & 20 deletions frontend/src/queries/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6957,8 +6957,15 @@
"additionalProperties": false,
"properties": {
"aggregation_group_type_index": {
"description": "Groups aggregation",
"type": "integer"
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"description": "Groups aggregation"
},
"breakdownFilter": {
"$ref": "#/definitions/BreakdownFilter",
Expand Down Expand Up @@ -8047,8 +8054,15 @@
"description": "Base class for insight query nodes. Should not be used directly.",
"properties": {
"aggregation_group_type_index": {
"description": "Groups aggregation",
"type": "integer"
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"description": "Groups aggregation"
},
"dateRange": {
"$ref": "#/definitions/InsightDateRange",
Expand Down Expand Up @@ -8097,8 +8111,15 @@
"description": "Base class for insight query nodes. Should not be used directly.",
"properties": {
"aggregation_group_type_index": {
"description": "Groups aggregation",
"type": "integer"
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"description": "Groups aggregation"
},
"dateRange": {
"$ref": "#/definitions/InsightDateRange",
Expand Down Expand Up @@ -8147,8 +8168,15 @@
"description": "Base class for insight query nodes. Should not be used directly.",
"properties": {
"aggregation_group_type_index": {
"description": "Groups aggregation",
"type": "integer"
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"description": "Groups aggregation"
},
"dateRange": {
"$ref": "#/definitions/InsightDateRange",
Expand Down Expand Up @@ -8197,8 +8225,15 @@
"description": "Base class for insight query nodes. Should not be used directly.",
"properties": {
"aggregation_group_type_index": {
"description": "Groups aggregation",
"type": "integer"
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"description": "Groups aggregation"
},
"dateRange": {
"$ref": "#/definitions/InsightDateRange",
Expand Down Expand Up @@ -8247,8 +8282,15 @@
"description": "Base class for insight query nodes. Should not be used directly.",
"properties": {
"aggregation_group_type_index": {
"description": "Groups aggregation",
"type": "integer"
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"description": "Groups aggregation"
},
"dateRange": {
"$ref": "#/definitions/InsightDateRange",
Expand Down Expand Up @@ -8350,8 +8392,15 @@
"additionalProperties": false,
"properties": {
"aggregation_group_type_index": {
"description": "Groups aggregation",
"type": "integer"
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"description": "Groups aggregation"
},
"dateRange": {
"$ref": "#/definitions/InsightDateRange",
Expand Down Expand Up @@ -8753,8 +8802,15 @@
"additionalProperties": false,
"properties": {
"aggregation_group_type_index": {
"description": "Groups aggregation",
"type": "integer"
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"description": "Groups aggregation"
},
"dateRange": {
"$ref": "#/definitions/InsightDateRange",
Expand Down Expand Up @@ -11598,8 +11654,15 @@
"additionalProperties": false,
"properties": {
"aggregation_group_type_index": {
"description": "Groups aggregation",
"type": "integer"
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"description": "Groups aggregation"
},
"dateRange": {
"$ref": "#/definitions/InsightDateRange",
Expand Down Expand Up @@ -12795,8 +12858,15 @@
"additionalProperties": false,
"properties": {
"aggregation_group_type_index": {
"description": "Groups aggregation",
"type": "integer"
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"description": "Groups aggregation"
},
"breakdownFilter": {
"$ref": "#/definitions/BreakdownFilter",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/queries/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ export interface InsightsQueryBase<R extends AnalyticsQueryResponseBase<any>> ex
/**
* Groups aggregation
*/
aggregation_group_type_index?: integer
aggregation_group_type_index?: integer | null
/** Sampling rate */
samplingFactor?: number | null
/** Modifiers used when performing the query */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function StepOrderInfo(): JSX.Element {

type ExclusionStepsInfoProps = {
aggregationTargetLabel: Noun
aggregation_group_type_index?: number
aggregation_group_type_index?: number | null
}

function ExclusionStepsInfo({
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/scenes/insights/filters/AggregationSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { FunnelsQuery } from '~/queries/schema'
import { isFunnelsQuery, isInsightQueryNode, isStickinessQuery } from '~/queries/utils'
import { InsightLogicProps } from '~/types'

export function getHogQLValue(groupIndex?: number, aggregationQuery?: string): string {
if (groupIndex !== undefined) {
export function getHogQLValue(groupIndex?: number | null, aggregationQuery?: string): string {
if (groupIndex != undefined) {
return `$group_${groupIndex}`
} else if (aggregationQuery) {
return aggregationQuery
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/scenes/retention/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { performQuery } from '~/queries/query'
import { ActorsQuery, NodeKind, RetentionQuery } from '~/queries/schema'

export function retentionToActorsQuery(query: RetentionQuery, selectedInterval: number, offset = 0): ActorsQuery {
const group = query.aggregation_group_type_index !== undefined
const group = query.aggregation_group_type_index != null
const selectActor = group ? 'group' : 'person'
const totalIntervals = (query.retentionFilter.totalIntervals || 11) - selectedInterval
const periodName = query.retentionFilter.period?.toLowerCase() ?? 'day'
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/scenes/trends/trendsDataLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export const trendsDataLogic = kea<trendsDataLogicType>([
(s) => [s.series, s.querySource, s.isLifecycle],
(series, querySource, isLifecycle): 'people' | 'none' | number => {
// Find the commonly shared aggregation group index if there is one.
let firstAggregationGroupTypeIndex: 'people' | 'none' | number | undefined
let firstAggregationGroupTypeIndex: 'people' | 'none' | number | undefined | null
if (isLifecycle) {
firstAggregationGroupTypeIndex = (querySource as LifecycleQuery)?.aggregation_group_type_index
} else {
Expand Down

0 comments on commit 4db9b9f

Please sign in to comment.