diff --git a/frontend/src/scenes/experiments/ExperimentNext.tsx b/frontend/src/scenes/experiments/ExperimentNext.tsx index 01557833d7f80..78abe98ed39ac 100644 --- a/frontend/src/scenes/experiments/ExperimentNext.tsx +++ b/frontend/src/scenes/experiments/ExperimentNext.tsx @@ -1,15 +1,20 @@ import './Experiment.scss' +import { LemonDivider } from '@posthog/lemon-ui' import { useActions, useValues } from 'kea' import { ExperimentForm } from './ExperimentForm' import { ExperimentImplementationDetails } from './ExperimentImplementationDetails' import { experimentLogic } from './experimentLogic' -import { ExperimentLoader, ExperimentLoadingAnimation, PageHeaderCustom } from './ExperimentView/components' +import { + ExperimentLoader, + ExperimentLoadingAnimation, + NoResultsEmptyState, + PageHeaderCustom, +} from './ExperimentView/components' import { DistributionTable } from './ExperimentView/DistributionTable' import { ExperimentExposureModal, ExperimentGoalModal, Goal } from './ExperimentView/Goal' import { Info } from './ExperimentView/Info' -import { NoResultsEmptyState } from './ExperimentView/NoResultsEmptyState' import { Overview } from './ExperimentView/Overview' import { ProgressBar } from './ExperimentView/ProgressBar' import { ReleaseConditionsTable } from './ExperimentView/ReleaseConditionsTable' @@ -35,16 +40,20 @@ export function ExperimentView(): JSX.Element { ) : experimentResults && experimentResults.insight ? ( <> - - - +
+ + +
+
+
+ +
+ +
+ +
+
- updateExperimentSecondaryMetrics(metrics)} - initialMetrics={experiment.secondary_metrics} - defaultAggregationType={experiment.parameters?.aggregation_group_type_index} - /> @@ -55,6 +64,12 @@ export function ExperimentView(): JSX.Element { {experiment.start_date && } )} + updateExperimentSecondaryMetrics(metrics)} + initialMetrics={experiment.secondary_metrics} + defaultAggregationType={experiment.parameters?.aggregation_group_type_index} + /> diff --git a/frontend/src/scenes/experiments/ExperimentView/DistributionTable.tsx b/frontend/src/scenes/experiments/ExperimentView/DistributionTable.tsx index 43b3c50ed614b..6dbaf4a331814 100644 --- a/frontend/src/scenes/experiments/ExperimentView/DistributionTable.tsx +++ b/frontend/src/scenes/experiments/ExperimentView/DistributionTable.tsx @@ -2,13 +2,12 @@ import '../Experiment.scss' import { LemonTable, LemonTableColumns, Link } from '@posthog/lemon-ui' import { useValues } from 'kea' -import { getSeriesColor } from 'lib/colors' -import { capitalizeFirstLetter } from 'lib/utils' import { urls } from 'scenes/urls' import { MultivariateFlagVariant } from '~/types' import { experimentLogic } from '../experimentLogic' +import { VariantTag } from './components' export function DistributionTable(): JSX.Element { const { experiment } = useValues(experimentLogic) @@ -18,17 +17,8 @@ export function DistributionTable(): JSX.Element { className: 'w-1/3', key: 'key', title: 'Variant', - render: function Key(_, item, index): JSX.Element { - return ( -
-
- {capitalizeFirstLetter(item.key)} -
- ) + render: function Key(_, item): JSX.Element { + return }, }, { diff --git a/frontend/src/scenes/experiments/ExperimentView/Goal.tsx b/frontend/src/scenes/experiments/ExperimentView/Goal.tsx index d1406633d4e86..608b0a584457f 100644 --- a/frontend/src/scenes/experiments/ExperimentView/Goal.tsx +++ b/frontend/src/scenes/experiments/ExperimentView/Goal.tsx @@ -204,8 +204,8 @@ export function Goal(): JSX.Element { return (
-

Experiment goal

-
+

Experiment goal

+
This {experimentInsightType === InsightType.FUNNELS ? 'funnel' : 'trend'}{' '} {experimentInsightType === InsightType.FUNNELS ? 'experiment measures conversion through each step of the user journey.' diff --git a/frontend/src/scenes/experiments/ExperimentView/NoResultsEmptyState.tsx b/frontend/src/scenes/experiments/ExperimentView/NoResultsEmptyState.tsx deleted file mode 100644 index c4c021a3c382e..0000000000000 --- a/frontend/src/scenes/experiments/ExperimentView/NoResultsEmptyState.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import '../Experiment.scss' - -import { Empty } from 'antd' -import { useValues } from 'kea' - -import { experimentLogic } from '../experimentLogic' - -export function NoResultsEmptyState(): JSX.Element { - const { experimentResultsLoading, experimentResultCalculationError } = useValues(experimentLogic) - - if (experimentResultsLoading) { - return <> - } - - return ( -
-

Results

-
-
- -

There are no experiment results yet

- {!!experimentResultCalculationError && ( -
{experimentResultCalculationError}
- )} -
- Wait a bit longer for your users to be exposed to the experiment. Double check your feature flag - implementation if you're still not seeing results. -
-
-
-
- ) -} diff --git a/frontend/src/scenes/experiments/ExperimentView/Overview.tsx b/frontend/src/scenes/experiments/ExperimentView/Overview.tsx index 76cc2136116d4..1b6bef968971a 100644 --- a/frontend/src/scenes/experiments/ExperimentView/Overview.tsx +++ b/frontend/src/scenes/experiments/ExperimentView/Overview.tsx @@ -1,95 +1,87 @@ import '../Experiment.scss' -import { LemonDivider } from '@posthog/lemon-ui' import { useValues } from 'kea' -import { getSeriesColor } from 'lib/colors' -import { capitalizeFirstLetter } from 'lib/utils' import { InsightType } from '~/types' import { experimentLogic } from '../experimentLogic' +import { VariantTag } from './components' export function Overview(): JSX.Element { const { experimentResults, getIndexForVariant, experimentInsightType, - sortedConversionRates, - highestProbabilityVariant, + getHighestProbabilityVariant, areResultsSignificant, + conversionRateForVariant, } = useValues(experimentLogic) - function SignificanceText(): JSX.Element { - return ( - <> - Your results are  - {`${areResultsSignificant ? 'significant' : 'not significant'}`}. - - ) - } + function WinningVariantText(): JSX.Element { + const winningVariant = getHighestProbabilityVariant(experimentResults) - if (experimentInsightType === InsightType.FUNNELS) { - const winningVariant = sortedConversionRates[0] - const secondBestVariant = sortedConversionRates[1] - const difference = winningVariant.conversionRate - secondBestVariant.conversionRate + if (experimentInsightType === InsightType.FUNNELS) { + const winningConversionRate = conversionRateForVariant(experimentResults, winningVariant || '') + const controlConversionRate = conversionRateForVariant(experimentResults, 'control') + const difference = parseFloat(winningConversionRate) - parseFloat(controlConversionRate) - return ( -
-

Summary

+ if (difference === 0) { + return ( + + No variant is winning at this moment.  + + ) + } + + return (
-
- {capitalizeFirstLetter(winningVariant.key)} +  is winning with a conversion rate  increase of {`${difference.toFixed(2)}%`}  percentage points (vs  -
- {capitalizeFirstLetter(secondBestVariant.key)} + ).  -
-
- ) - } + ) + } - const index = getIndexForVariant(experimentResults, highestProbabilityVariant || '') - if (highestProbabilityVariant && index !== null && experimentResults) { - const { probability } = experimentResults + const index = getIndexForVariant(experimentResults, winningVariant || '') + if (winningVariant && index !== null && experimentResults) { + const { probability } = experimentResults - return ( -
-

Overview

- -
-
- {capitalizeFirstLetter(highestProbabilityVariant)} + return ( +
+  is winning with a  - {`${(probability[highestProbabilityVariant] * 100).toFixed(2)}% probability`}  + {`${(probability[winningVariant] * 100).toFixed(2)}% probability`}  of being best.  -
+ ) + } + + return <> + } + + function SignificanceText(): JSX.Element { + return ( +
+ Your results are  + {`${areResultsSignificant ? 'significant' : 'not significant'}`}.
) } - return <> + return ( +
+

Summary

+
+ + +
+
+ ) } diff --git a/frontend/src/scenes/experiments/ExperimentView/ProgressBar.tsx b/frontend/src/scenes/experiments/ExperimentView/ProgressBar.tsx index 1cedbcf500d6c..229003ead99ac 100644 --- a/frontend/src/scenes/experiments/ExperimentView/ProgressBar.tsx +++ b/frontend/src/scenes/experiments/ExperimentView/ProgressBar.tsx @@ -30,7 +30,12 @@ export function ProgressBar(): JSX.Element { return (
-
{`${ +

Data collection

+
+ Estimated target for the number of participants. Actual data may reveal significance earlier or later + than predicted. +
+
{`${ experimentProgressPercent > 100 ? 100 : experimentProgressPercent.toFixed(2) }% complete`}
- +
) } diff --git a/frontend/src/scenes/experiments/ExperimentView/SecondaryMetricsTable.tsx b/frontend/src/scenes/experiments/ExperimentView/SecondaryMetricsTable.tsx index ea9c7befcdd7f..069531e45ff96 100644 --- a/frontend/src/scenes/experiments/ExperimentView/SecondaryMetricsTable.tsx +++ b/frontend/src/scenes/experiments/ExperimentView/SecondaryMetricsTable.tsx @@ -1,12 +1,13 @@ import '../Experiment.scss' -import { IconPlus } from '@posthog/icons' +import { IconPencil, IconPlus } from '@posthog/icons' import { LemonButton, LemonInput, LemonModal, LemonTable, LemonTableColumns } from '@posthog/lemon-ui' import { useActions, useValues } from 'kea' import { Form } from 'kea-forms' +import { EntityFilterInfo } from 'lib/components/EntityFilterInfo' import { IconAreaChart } from 'lib/lemon-ui/icons' import { LemonField } from 'lib/lemon-ui/LemonField' -import { capitalizeFirstLetter, humanFriendlyNumber } from 'lib/utils' +import { capitalizeFirstLetter } from 'lib/utils' import { InsightType } from '~/types' @@ -14,100 +15,46 @@ import { SECONDARY_METRIC_INSIGHT_ID } from '../constants' import { experimentLogic, TabularSecondaryMetricResults } from '../experimentLogic' import { MetricSelector } from '../MetricSelector' import { secondaryMetricsLogic, SecondaryMetricsProps } from '../secondaryMetricsLogic' -import { getExperimentInsightColour } from '../utils' +import { ResultsQuery, VariantTag } from './components' -export function SecondaryMetricsTable({ +export function SecondaryMetricsModal({ onMetricsChange, initialMetrics, experimentId, defaultAggregationType, }: SecondaryMetricsProps): JSX.Element { const logic = secondaryMetricsLogic({ onMetricsChange, initialMetrics, experimentId, defaultAggregationType }) - const { metrics, isModalOpen, isSecondaryMetricModalSubmitting, existingModalSecondaryMetric, metricIdx } = - useValues(logic) - const { - deleteMetric, - openModalToCreateSecondaryMetric, - openModalToEditSecondaryMetric, - closeModal, - saveSecondaryMetric, - setPreviewInsight, - } = useActions(logic) + secondaryMetricModal, + isModalOpen, + showResults, + isSecondaryMetricModalSubmitting, + existingModalSecondaryMetric, + metricIdx, + } = useValues(logic) - const { - secondaryMetricResultsLoading, - isExperimentRunning, - getIndexForVariant, - experiment, - experimentResults, - tabularSecondaryMetricResults, - } = useValues(experimentLogic({ experimentId })) - - const columns: LemonTableColumns = [ - { - key: 'variant', - title: 'Variant', - render: function Key(_, item: TabularSecondaryMetricResults): JSX.Element { - return ( -
-
- {capitalizeFirstLetter(item.variant)} -
- ) - }, - }, - ] - - experiment.secondary_metrics?.forEach((metric, idx) => { - columns.push({ - key: `results_${idx}`, - title: ( - - } - onClick={() => openModalToEditSecondaryMetric(metric, idx)} - > - {capitalizeFirstLetter(metric.name)} - - - ), - render: function Key(_, item: TabularSecondaryMetricResults): JSX.Element { - return ( -
- {item.results?.[idx].result ? ( - item.results[idx].insightType === InsightType.FUNNELS ? ( - <>{((item.results[idx].result as number) * 100).toFixed(1)}% - ) : ( - <>{humanFriendlyNumber(item.results[idx].result as number)} - ) - ) : ( - <>-- - )} -
- ) - }, - }) - }) + const { deleteMetric, closeModal, saveSecondaryMetric, setPreviewInsight } = useActions(logic) + const { secondaryMetricResults, isExperimentRunning } = useValues(experimentLogic({ experimentId })) + const targetResults = secondaryMetricResults && secondaryMetricResults[metricIdx] return ( - <> - + Close + + ) : ( <> {existingModalSecondaryMetric && (
- } - > + ) + } + > + {showResults && targetResults ? ( +
+ +
+ ) : (
- + )} + + ) +} + +export function SecondaryMetricsTable({ + onMetricsChange, + initialMetrics, + experimentId, + defaultAggregationType, +}: SecondaryMetricsProps): JSX.Element { + const logic = secondaryMetricsLogic({ onMetricsChange, initialMetrics, experimentId, defaultAggregationType }) + const { metrics } = useValues(logic) + + const { openModalToCreateSecondaryMetric, openModalToEditSecondaryMetric } = useActions(logic) + + const { + secondaryMetricResultsLoading, + isExperimentRunning, + experiment, + secondaryMetricResults, + tabularSecondaryMetricResults, + countDataForVariant, + exposureCountDataForVariant, + conversionRateForVariant, + experimentMathAggregationForTrends, + getHighestProbabilityVariant, + } = useValues(experimentLogic({ experimentId })) + + const columns: LemonTableColumns = [ + { + children: [ + { + title:
Variant
, + render: function Key(_, item: TabularSecondaryMetricResults): JSX.Element { + return ( +
+ +
+ ) + }, + }, + ], + }, + ] + + experiment.secondary_metrics?.forEach((metric, idx) => { + const Header = (): JSX.Element => ( +
+
+
{capitalizeFirstLetter(metric.name)}
+
+
+ } + onClick={() => openModalToEditSecondaryMetric(metric, idx, true)} + /> + } + onClick={() => openModalToEditSecondaryMetric(metric, idx, false)} + /> +
+
+
+
+ ) + + const targetResults = secondaryMetricResults?.[idx] + const targetResultFilters = targetResults?.filters + const winningVariant = getHighestProbabilityVariant(targetResults || null) + + if (metric.filters.insight === InsightType.TRENDS) { + columns.push({ + title:
, + children: [ + { + title: ( +
+ [ + {targetResults && + targetResults.insight?.[0] && + 'action' in targetResults.insight[0] && ( + + )} + ] + + {experimentMathAggregationForTrends(targetResultFilters) ? 'metric' : 'count'} + +
+ ), + render: function Key(_, item: TabularSecondaryMetricResults): JSX.Element { + const { variant } = item + return
{targetResults ? countDataForVariant(targetResults, variant) : '--'}
+ }, + }, + { + title: 'Exposure', + render: function Key(_, item: TabularSecondaryMetricResults): JSX.Element { + const { variant } = item + return ( +
{targetResults ? exposureCountDataForVariant(targetResults, variant) : '--'}
+ ) + }, + }, + { + title: 'Win probability', + render: function Key(_, item: TabularSecondaryMetricResults): JSX.Element { + const { variant } = item + return ( +
+ + {targetResults?.probability?.[variant] != undefined + ? `${(targetResults.probability?.[variant] * 100).toFixed(1)}%` + : '--'} + +
+ ) + }, + }, + ], + }) + } else { + columns.push({ + title:
, + children: [ + { + title: 'Conversion rate', + render: function Key(_, item: TabularSecondaryMetricResults): JSX.Element { + const { variant } = item + const conversionRate = conversionRateForVariant(targetResults || null, variant) + return
{conversionRate === '--' ? conversionRate : `${conversionRate}%`}
+ }, + }, + { + title: 'Win probability', + render: function Key(_, item: TabularSecondaryMetricResults): JSX.Element { + const { variant } = item + return ( +
+ + {targetResults?.probability?.[variant] != undefined + ? `${(targetResults.probability?.[variant] * 100).toFixed(1)}%` + : '--'} + +
+ ) + }, + }, + ], + }) + } + }) + + return ( + <>

Secondary metrics

{metrics.length > 0 && ( -
Click a metric name to compare variants on a graph.
+
Monitor side effects of your experiment.
)}
@@ -183,6 +296,7 @@ export function SecondaryMetricsTable({
{metrics && metrics.length > 0 ? ( )}
+ ) } diff --git a/frontend/src/scenes/experiments/ExperimentView/SummaryTable.tsx b/frontend/src/scenes/experiments/ExperimentView/SummaryTable.tsx index b6d4b95674c2c..010ddf19db616 100644 --- a/frontend/src/scenes/experiments/ExperimentView/SummaryTable.tsx +++ b/frontend/src/scenes/experiments/ExperimentView/SummaryTable.tsx @@ -3,14 +3,13 @@ import '../Experiment.scss' import { IconInfo } from '@posthog/icons' import { LemonTable, LemonTableColumns, Tooltip } from '@posthog/lemon-ui' import { useValues } from 'kea' -import { getSeriesColor } from 'lib/colors' import { EntityFilterInfo } from 'lib/components/EntityFilterInfo' import { LemonProgress } from 'lib/lemon-ui/LemonProgress' -import { capitalizeFirstLetter } from 'lib/utils' import { FunnelExperimentVariant, InsightType, TrendExperimentVariant } from '~/types' import { experimentLogic } from '../experimentLogic' +import { VariantTag } from './components' export function SummaryTable(): JSX.Element { const { @@ -18,29 +17,26 @@ export function SummaryTable(): JSX.Element { experimentInsightType, exposureCountDataForVariant, conversionRateForVariant, - sortedConversionRates, experimentMathAggregationForTrends, countDataForVariant, areTrendResultsConfusing, + getHighestProbabilityVariant, } = useValues(experimentLogic) if (!experimentResults) { return <> } + const winningVariant = getHighestProbabilityVariant(experimentResults) + const columns: LemonTableColumns = [ { key: 'variants', title: 'Variant', - render: function Key(_, item, index): JSX.Element { + render: function Key(_, item): JSX.Element { return (
-
- {capitalizeFirstLetter(item.key)} +
) }, @@ -90,12 +86,8 @@ export function SummaryTable(): JSX.Element { key: 'conversionRate', title: 'Conversion rate', render: function Key(_, item): JSX.Element { - const isWinning = item.key === sortedConversionRates[0].key return ( -
{`${conversionRateForVariant( - experimentResults, - item.key - )}%`}
+
{`${conversionRateForVariant(experimentResults, item.key)}%`}
) }, }) @@ -105,16 +97,20 @@ export function SummaryTable(): JSX.Element { key: 'winProbability', title: 'Win probability', render: function Key(_, item): JSX.Element { + const variantKey = item.key const percentage = - experimentResults?.probability?.[item.key] != undefined && - experimentResults.probability?.[item.key] * 100 + experimentResults?.probability?.[variantKey] != undefined && + experimentResults.probability?.[variantKey] * 100 + const isWinning = variantKey === winningVariant return ( <> {percentage ? ( - {percentage.toFixed(2)}% + + {percentage.toFixed(2)}% + ) : ( '--' diff --git a/frontend/src/scenes/experiments/ExperimentView/components.tsx b/frontend/src/scenes/experiments/ExperimentView/components.tsx index 1a22957925e68..97378f917c1bd 100644 --- a/frontend/src/scenes/experiments/ExperimentView/components.tsx +++ b/frontend/src/scenes/experiments/ExperimentView/components.tsx @@ -1,16 +1,41 @@ import '../Experiment.scss' import { LemonButton, LemonDivider, LemonTable, LemonTag, LemonTagType } from '@posthog/lemon-ui' +import { Empty } from 'antd' import { useActions, useValues } from 'kea' import { AnimationType } from 'lib/animations/animations' import { Animation } from 'lib/components/Animation/Animation' import { PageHeader } from 'lib/components/PageHeader' import { dayjs } from 'lib/dayjs' import { More } from 'lib/lemon-ui/LemonButton/More' +import { capitalizeFirstLetter } from 'lib/utils' import { useEffect, useState } from 'react' +import { filtersToQueryNode } from '~/queries/nodes/InsightQuery/utils/filtersToQueryNode' +import { Query } from '~/queries/Query/Query' +import { NodeKind } from '~/queries/schema' +import { ExperimentResults, InsightShortId } from '~/types' + import { ResetButton } from '../Experiment' import { experimentLogic } from '../experimentLogic' +import { getExperimentInsightColour, transformResultFilters } from '../utils' + +export function VariantTag({ variantKey }: { variantKey: string }): JSX.Element { + const { experimentResults, getIndexForVariant } = useValues(experimentLogic) + + return ( + +
+ {capitalizeFirstLetter(variantKey)} + + ) +} export function ResultsTag(): JSX.Element { const { areResultsSignificant } = useValues(experimentLogic) @@ -41,6 +66,67 @@ export function ExperimentLoader(): JSX.Element { ) } +export function ResultsQuery({ + targetResults, + showTable, +}: { + targetResults: ExperimentResults['result'] | null + showTable: boolean +}): JSX.Element { + return ( + + ) +} + +export function NoResultsEmptyState(): JSX.Element { + const { experimentResultsLoading, experimentResultCalculationError } = useValues(experimentLogic) + + if (experimentResultsLoading) { + return <> + } + + return ( +
+

Results

+
+
+ +

There are no experiment results yet

+ {!!experimentResultCalculationError && ( +
{experimentResultCalculationError}
+ )} +
+ Wait a bit longer for your users to be exposed to the experiment. Double check your feature flag + implementation if you're still not seeing results. +
+
+
+
+ ) +} + export function ExperimentLoadingAnimation(): JSX.Element { function EllipsisAnimation(): JSX.Element { const [ellipsis, setEllipsis] = useState('.') diff --git a/frontend/src/scenes/experiments/experimentLogic.tsx b/frontend/src/scenes/experiments/experimentLogic.tsx index cf1a0fb6b3e93..7ac11fb55f043 100644 --- a/frontend/src/scenes/experiments/experimentLogic.tsx +++ b/frontend/src/scenes/experiments/experimentLogic.tsx @@ -970,26 +970,27 @@ export const experimentLogic = kea([ } }, ], - highestProbabilityVariant: [ - (s) => [s.experimentResults], - (experimentResults: ExperimentResults['result']) => { - if (experimentResults) { - const maxValue = Math.max(...Object.values(experimentResults.probability)) - return Object.keys(experimentResults.probability).find( - (key) => Math.abs(experimentResults.probability[key] - maxValue) < Number.EPSILON + getHighestProbabilityVariant: [ + () => [], + () => (results: ExperimentResults['result'] | null) => { + if (results && results.probability) { + const maxValue = Math.max(...Object.values(results.probability)) + return Object.keys(results.probability).find( + (key) => Math.abs(results.probability[key] - maxValue) < Number.EPSILON ) } }, ], areTrendResultsConfusing: [ - (s) => [s.experimentResults, s.highestProbabilityVariant], - (experimentResults, highestProbabilityVariant): boolean => { + (s) => [s.experimentResults, s.getHighestProbabilityVariant], + (experimentResults, getHighestProbabilityVariant): boolean => { // Results are confusing when the top variant has a lower // absolute count than other variants. This happens because // exposure is invisible to the user if (!experimentResults) { return false } + // find variant with highest count const variantResults: TrendResult = (experimentResults?.insight as TrendResult[]).reduce( (bestVariant, currentVariant) => @@ -1000,7 +1001,7 @@ export const experimentLogic = kea([ return false } - return variantResults.breakdown_value !== highestProbabilityVariant + return variantResults.breakdown_value !== getHighestProbabilityVariant(experimentResults) }, ], sortedExperimentResultVariants: [ diff --git a/frontend/src/scenes/experiments/secondaryMetricsLogic.ts b/frontend/src/scenes/experiments/secondaryMetricsLogic.ts index a12bc0f4a7547..cad1e1013e63a 100644 --- a/frontend/src/scenes/experiments/secondaryMetricsLogic.ts +++ b/frontend/src/scenes/experiments/secondaryMetricsLogic.ts @@ -65,9 +65,14 @@ export const secondaryMetricsLogic = kea([ actions({ // modal openModalToCreateSecondaryMetric: true, - openModalToEditSecondaryMetric: (metric: SecondaryExperimentMetric, metricIdx: number) => ({ + openModalToEditSecondaryMetric: ( + metric: SecondaryExperimentMetric, + metricIdx: number, + showResults: boolean = false + ) => ({ metric, metricIdx, + showResults, }), saveSecondaryMetric: true, closeModal: true, @@ -90,6 +95,13 @@ export const secondaryMetricsLogic = kea([ closeModal: () => false, }, ], + showResults: [ + false, + { + openModalToEditSecondaryMetric: (_, { showResults }) => showResults, + closeModal: () => false, + }, + ], existingModalSecondaryMetric: [ null as SecondaryExperimentMetric | null, { diff --git a/frontend/src/types.ts b/frontend/src/types.ts index 3fc125fe4f86c..f24dbec6a7eae 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -2922,7 +2922,7 @@ export interface FunnelExperimentResults { export type ExperimentResults = TrendsExperimentResults | FunnelExperimentResults -export type SecondaryMetricResults = Partial & { +export type SecondaryMetricResults = ExperimentResults['result'] & { result?: Record } export interface SecondaryExperimentMetric {