Skip to content

Commit

Permalink
fix(experiments): Restore editing Trends exposure metric (#27241)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbachhuber authored Jan 3, 2025
1 parent 12eb711 commit c40b194
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion frontend/src/scenes/experiments/ExperimentView/Goal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ export function MetricDisplayOld({ filters }: { filters?: FilterType }): JSX.Ele

export function ExposureMetric({ experimentId }: { experimentId: Experiment['id'] }): JSX.Element {
const { experiment, featureFlags } = useValues(experimentLogic({ experimentId }))
const { updateExperimentGoal, loadExperiment, setExperiment } = useActions(experimentLogic({ experimentId }))
const { updateExperimentGoal, loadExperiment, setExperiment, setEditingPrimaryMetricIndex } = useActions(
experimentLogic({ experimentId })
)
const [isModalOpen, setIsModalOpen] = useState(false)

const metricIdx = 0
Expand Down Expand Up @@ -201,6 +203,7 @@ export function ExposureMetric({ experimentId }: { experimentId: Experiment['id'
})
}
}
setEditingPrimaryMetricIndex(metricIdx)
setIsModalOpen(true)
}}
className="mr-2"
Expand Down Expand Up @@ -232,6 +235,7 @@ export function ExposureMetric({ experimentId }: { experimentId: Experiment['id'
isOpen={isModalOpen}
onClose={() => {
setIsModalOpen(false)
setEditingPrimaryMetricIndex(null)
loadExperiment()
}}
/>
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/scenes/experiments/experimentLogic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ export const experimentLogic = kea<experimentLogicType>([
openPrimaryMetricModal: (index: number) => ({ index }),
closePrimaryMetricModal: true,
setPrimaryMetricsResultErrors: (errors: any[]) => ({ errors }),
setEditingPrimaryMetricIndex: (index: number | null) => ({ index }),
updateDistributionModal: (featureFlag: FeatureFlagType) => ({ featureFlag }),
openSecondaryMetricModal: (index: number) => ({ index }),
closeSecondaryMetricModal: true,
Expand Down Expand Up @@ -511,6 +512,7 @@ export const experimentLogic = kea<experimentLogicType>([
openPrimaryMetricModal: (_, { index }) => index,
closePrimaryMetricModal: () => null,
updateExperimentGoal: () => null,
setEditingPrimaryMetricIndex: (_, { index }) => index,
},
],
primaryMetricsResultErrors: [
Expand Down

0 comments on commit c40b194

Please sign in to comment.