Skip to content

Commit

Permalink
disable save btn until insight loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
jurajmajerik committed Apr 24, 2024
1 parent c9d56b8 commit d33c405
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion frontend/src/scenes/experiments/ExperimentView/Goal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ export function ExposureMetric({ experimentId }: { experimentId: Experiment['id'
}

export function ExperimentGoalModal({ experimentId }: { experimentId: Experiment['id'] }): JSX.Element {
const { experiment, isExperimentGoalModalOpen, experimentLoading } = useValues(experimentLogic({ experimentId }))
const { experiment, isExperimentGoalModalOpen, experimentLoading, goalInsightDataLoading } = useValues(
experimentLogic({ experimentId })
)
const { closeExperimentGoalModal, updateExperimentGoal, setNewExperimentInsight } = useActions(
experimentLogic({ experimentId })
)
Expand All @@ -108,6 +110,9 @@ export function ExperimentGoalModal({ experimentId }: { experimentId: Experiment
Cancel
</LemonButton>
<LemonButton
disabledReason={
goalInsightDataLoading && 'The insight needs to be loaded before saving the goal'
}
form="edit-experiment-goal-form"
onClick={() => {
updateExperimentGoal(experiment.filters)
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 @@ -106,6 +106,8 @@ export const experimentLogic = kea<experimentLogicType>([
['conversionMetrics'],
trendsDataLogic({ dashboardItemId: EXPERIMENT_INSIGHT_ID }),
['results as trendResults'],
insightDataLogic({ dashboardItemId: EXPERIMENT_INSIGHT_ID }),
['insightDataLoading as goalInsightDataLoading'],
],
actions: [
experimentsLogic,
Expand Down

0 comments on commit d33c405

Please sign in to comment.