diff --git a/src/components/GoalCriteria/GoalCriteria.tsx b/src/components/GoalCriteria/GoalCriteria.tsx index f3ac351d2..36baf2b67 100644 --- a/src/components/GoalCriteria/GoalCriteria.tsx +++ b/src/components/GoalCriteria/GoalCriteria.tsx @@ -246,7 +246,7 @@ const criteriaGuard = (props: GoalCriteriaItemProps): props is CriteriaAsGoalPro type CriteriaActionItem = { label: string; - onClick: () => void; + handler: () => void; color?: string; icon: React.ReactNode; }; @@ -293,7 +293,7 @@ const GoalCriteriaItem: React.FC = memo((props) => { actions.push({ label: tr('Create as goal'), icon: , - onClick: onConvertToGoal, + handler: onConvertToGoal, }); } @@ -301,12 +301,16 @@ const GoalCriteriaItem: React.FC = memo((props) => { label: tr('Delete'), icon: , color: danger0, - onClick: onRemove, + handler: onRemove, }); return actions; }, [canEdit, onRemove, props, onConvertToGoal]); + const handleChange = useCallback((val: CriteriaActionItem) => { + val.handler(); + }, []); + return ( {criteriaGuard(props) ? ( @@ -342,12 +346,13 @@ const GoalCriteriaItem: React.FC = memo((props) => { {nullable(availableActions, (actions) => ( } items={actions} renderItem={(props) => (