Skip to content

Commit

Permalink
chore(experiments): big frontend cleanup (#27744)
Browse files Browse the repository at this point in the history
  • Loading branch information
jurajmajerik authored Jan 22, 2025
1 parent 06eb413 commit 8a8adc1
Show file tree
Hide file tree
Showing 19 changed files with 131 additions and 887 deletions.
1 change: 0 additions & 1 deletion frontend/src/lib/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ export const FEATURE_FLAGS = {
FIRST_TIME_FOR_USER_MATH: 'first-time-for-user-math', // owner: @skoob13 #team-product-analytics
MULTITAB_EDITOR: 'multitab-editor', // owner: @EDsCODE #team-data-warehouse
BATCH_EXPORTS_POSTHOG_HTTP: 'posthog-http-batch-exports',
EXPERIMENT_MAKE_DECISION: 'experiment-make-decision', // owner: @jurajmajerik #team-feature-success
DATA_MODELING: 'data-modeling', // owner: @EDsCODE #team-data-warehouse
HEDGEHOG_SKIN_SPIDERHOG: 'hedgehog-skin-spiderhog', // owner: @benjackwhite
INSIGHT_VARIABLES: 'insight_variables', // owner: @Gilbert09 #team-data-warehouse
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/scenes/experiments/ExperimentForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { experimentLogic } from './experimentLogic'

const ExperimentFormFields = (): JSX.Element => {
const { experiment, groupTypes, aggregationLabel } = useValues(experimentLogic)
const { addExperimentGroup, removeExperimentGroup, setExperiment, createExperiment, setExperimentType } =
const { addVariant, removeExperimentGroup, setExperiment, createExperiment, setExperimentType } =
useActions(experimentLogic)
const { webExperimentsAvailable } = useValues(experimentsLogic)
const { groupsAccessStatus } = useValues(groupsAccessLogic)
Expand Down Expand Up @@ -219,7 +219,7 @@ const ExperimentFormFields = (): JSX.Element => {
<LemonButton
className="ml-9 mt-2"
type="secondary"
onClick={() => addExperimentGroup()}
onClick={() => addVariant()}
icon={<IconPlusSmall />}
data-attr="add-test-variant"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import { BaseMathType, ChartDisplayType, InsightType, PropertyFilterType, Proper
import { experimentLogic } from '../experimentLogic'

export function CumulativeExposuresChart(): JSX.Element {
const { experiment, metricResults, _getMetricType } = useValues(experimentLogic)
const { experiment, metricResults, getMetricType } = useValues(experimentLogic)

const metricIdx = 0
const metricType = _getMetricType(experiment.metrics[metricIdx])
const metricType = getMetricType(experiment.metrics[metricIdx])
const result = metricResults?.[metricIdx]
const variants = experiment.parameters?.feature_flag_variants?.map((variant) => variant.key) || []
if (experiment.holdout) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ export function DataCollection(): JSX.Element {
const {
experimentId,
experiment,
_getMetricType,
getMetricType,
funnelResultsPersonsTotal,
actualRunningTime,
minimumDetectableEffect,
} = useValues(experimentLogic)

const { openExperimentCollectionGoalModal } = useActions(experimentLogic)

const metricType = _getMetricType(experiment.metrics[0])
const metricType = getMetricType(experiment.metrics[0])

const recommendedRunningTime = experiment?.parameters?.recommended_running_time || 1
const recommendedSampleSize = experiment?.parameters?.recommended_sample_size || 100
Expand Down Expand Up @@ -173,15 +173,15 @@ export function DataCollectionGoalModal({ experimentId }: { experimentId: Experi
const {
isExperimentCollectionGoalModalOpen,
experiment,
_getMetricType,
getMetricType,
trendMetricInsightLoading,
funnelMetricInsightLoading,
} = useValues(experimentLogic({ experimentId }))
const { closeExperimentCollectionGoalModal, updateExperimentCollectionGoal, restoreUnmodifiedExperiment } =
useActions(experimentLogic({ experimentId }))

const isInsightLoading =
_getMetricType(experiment.metrics[0]) === InsightType.TRENDS
getMetricType(experiment.metrics[0]) === InsightType.TRENDS
? trendMetricInsightLoading
: funnelMetricInsightLoading

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ function TrendCalculation({ experimentId }: ExperimentCalculatorProps): JSX.Elem
}

export function DataCollectionCalculator({ experimentId }: ExperimentCalculatorProps): JSX.Element {
const { _getMetricType, minimumDetectableEffect, experiment, conversionMetrics } = useValues(
const { getMetricType, minimumDetectableEffect, experiment, conversionMetrics } = useValues(
experimentLogic({ experimentId })
)
const { setExperiment } = useActions(experimentLogic({ experimentId }))

const metricType = _getMetricType(experiment.metrics[0])
const metricType = getMetricType(experiment.metrics[0])

// :KLUDGE: need these to mount the Query component to load the insight */
const insightLogicInstance = insightLogic({
Expand Down Expand Up @@ -217,7 +217,7 @@ export function DataCollectionCalculator({ experimentId }: ExperimentCalculatorP
The calculations are based on the events received in the last 14 days. This event count may
differ from what was considered in earlier estimates.
</LemonBanner>
{_getMetricType(experiment.metrics[0]) === InsightType.TRENDS ? (
{getMetricType(experiment.metrics[0]) === InsightType.TRENDS ? (
<TrendCalculation experimentId={experimentId} />
) : (
<FunnelCalculation experimentId={experimentId} />
Expand Down
264 changes: 0 additions & 264 deletions frontend/src/scenes/experiments/ExperimentView/Goal.tsx

This file was deleted.

21 changes: 0 additions & 21 deletions frontend/src/scenes/experiments/ExperimentView/Results.tsx

This file was deleted.

Loading

0 comments on commit 8a8adc1

Please sign in to comment.