diff --git a/ui/src/components/GoalTree.tsx b/ui/src/components/GoalTree.tsx index fe20ee64..116b1668 100644 --- a/ui/src/components/GoalTree.tsx +++ b/ui/src/components/GoalTree.tsx @@ -92,7 +92,8 @@ function GoalNode({ goal, children, allGoals, depth, goalLink, onSelect }: GoalN } export function GoalTree({ goals, goalLink, onSelect }: GoalTreeProps) { - const roots = goals.filter((g) => !g.parentId); + const goalIds = new Set(goals.map((g) => g.id)); + const roots = goals.filter((g) => !g.parentId || !goalIds.has(g.parentId)); if (goals.length === 0) { return

No goals.

;