Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address claude review: stable proposal keys + non-mutating order reassignment (#898)

Adam Eivy3492476caa66
diff --git a/client/src/components/goals/GoalPlanSection.jsx b/client/src/components/goals/GoalPlanSection.jsx
index ebe737281a..69f8e9cbcd 100644
--- a/client/src/components/goals/GoalPlanSection.jsx
+++ b/client/src/components/goals/GoalPlanSection.jsx
@@ -148,7 +148,7 @@ export default function GoalPlanSection({
<div className="space-y-1.5">
<p className="text-[10px] text-gray-500">{proposedDecomposition.length} milestones proposed</p>
{proposedDecomposition.map((ms, idx) => (
- <div key={idx} className="p-2 rounded bg-port-bg border border-port-border space-y-1.5">
+ <div key={ms._key ?? idx} className="p-2 rounded bg-port-bg border border-port-border space-y-1.5">
<div className="flex items-start gap-2">
<div className="flex flex-col gap-0.5 pt-0.5">
<button
@@ -156,8 +156,7 @@ export default function GoalPlanSection({
if (idx === 0) return;
const next = [...proposedDecomposition];
[next[idx - 1], next[idx]] = [next[idx], next[idx - 1]];
- next.forEach((m, i) => { m.order = i; });
- setProposedDecomposition(next);
+ setProposedDecomposition(next.map((m, i) => ({ ...m, order: i })));
}}
disabled={idx === 0}
className="text-gray-600 hover:text-white disabled:opacity-30"
@@ -169,8 +168,7 @@ export default function GoalPlanSection({
if (idx === proposedDecomposition.length - 1) return;
const next = [...proposedDecomposition];
[next[idx], next[idx + 1]] = [next[idx + 1], next[idx]];
- next.forEach((m, i) => { m.order = i; });
- setProposedDecomposition(next);
+ setProposedDecomposition(next.map((m, i) => ({ ...m, order: i })));
}}
disabled={idx === proposedDecomposition.length - 1}
className="text-gray-600 hover:text-white disabled:opacity-30"
diff --git a/client/src/hooks/useGoalDetail.js b/client/src/hooks/useGoalDetail.js
index 0502cafc67..b1294ac5e7 100644
--- a/client/src/hooks/useGoalDetail.js
+++ b/client/src/hooks/useGoalDetail.js
@@ -92,7 +92,10 @@ export function useGoalDetail({ goal, allGoals, onClose, onRefresh }) {
setDecomposing(true);
const milestones = await api.decomposeGoal(goal.id).catch(() => null);
setDecomposing(false);
- if (milestones) setProposedDecomposition(milestones);
+ // Stamp a stable client key so the reorderable/editable proposal list keys
+ // on identity, not array index (index keys mis-associate controlled-input
+ // state across a swap). `_key` is stripped by the accept Zod schema.
+ if (milestones) setProposedDecomposition(milestones.map((m, i) => ({ ...m, _key: `prop-${i}` })));
};
const handleAcceptDecomposition = async () => {