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 review (round 22): clear dirty on duplicate/delete so rehydrate runs

Adam Eivy42da1b73ea8b
diff --git a/client/src/components/dashboard/LayoutEditor.jsx b/client/src/components/dashboard/LayoutEditor.jsx
index 9046e91c6f..a612d8ee57 100644
--- a/client/src/components/dashboard/LayoutEditor.jsx
+++ b/client/src/components/dashboard/LayoutEditor.jsx
@@ -144,6 +144,10 @@ export default function LayoutEditor({ layouts, activeLayoutId, limits, onClose,
while (existingIds.has(id)) { n += 1; id = fitId(n); }
const ok = await onDuplicate({ id, name: trimmed, widgets }).then(() => true, () => false);
if (!ok) return;
+ // The duplicate IS saved — clear dirty so the rehydrate effect runs
+ // when the new layout lands in `layouts` props; otherwise the editor
+ // could show stale name/widgets for the new id.
+ setDirty(false);
setEditingId(id);
setMode('idle');
toast.success('New layout created');
@@ -153,6 +157,10 @@ export default function LayoutEditor({ layouts, activeLayoutId, limits, onClose,
const ok = await onDelete(editingId).then(() => true, () => false);
if (!ok) return;
const remaining = layouts.filter((l) => l.id !== editingId);
+ // The layout we were editing is gone — any in-flight edits on it are
+ // meaningless. Clear dirty so the rehydrate effect can sync to the
+ // next selected layout (otherwise the guard would leave stale state).
+ setDirty(false);
setMode('idle');
if (remaining.length > 0) setEditingId(remaining[0].id);
else close();