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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: keep edited text of a failed capture after closing the editor or a second failure (#9722)
[._.]/ Adam Eivy5622599a5254
diff --git a/client/src/components/brain/FailedCaptureList.jsx b/client/src/components/brain/FailedCaptureList.jsxindex 740b7e2cb7..0f057cbcdd 100644--- a/client/src/components/brain/FailedCaptureList.jsx+++ b/client/src/components/brain/FailedCaptureList.jsx@@ -12,19 +12,27 @@ import { AlertCircle, Pencil, RotateCcw, Trash2 } from 'lucide-react';* project the payload so each surface keeps its own payload shape.*/export default function FailedCaptureList({ failures, getText, getNote, onRetry, onDiscard, retryDisabled = false, idPrefix = 'failed-capture' }) {+ // `edits` keeps the user's changed text per row; `editingIds` only says which+ // rows currently show the textarea, so closing it never drops an edit.const [edits, setEdits] = useState({});+ const [editingIds, setEditingIds] = useState({});if (!failures.length) return null;- const closeEdit = (id) => setEdits((prev) => {- const { [id]: _removed, ...rest } = prev;- return rest;- });+ const setEditing = (id, on) => setEditingIds((prev) => ({ ...prev, [id]: on }));+ const forget = (id) => {+ const without = (prev) => {+ const { [id]: _removed, ...rest } = prev;+ return rest;+ };+ setEdits(without);+ setEditingIds(without);+ };return (<ul className="mt-3 space-y-2 min-w-0" aria-label="Captures not saved">{failures.map((f) => {- const editing = edits[f.id] !== undefined;+ const editing = !!editingIds[f.id];const text = edits[f.id] ?? getText(f);const note = getNote?.(f);return (@@ -54,7 +62,7 @@ export default function FailedCaptureList({ failures, getText, getNote, onRetry,<div className="mt-2 flex flex-wrap gap-2"><buttontype="button"- onClick={() => (editing ? closeEdit(f.id) : setEdits((prev) => ({ ...prev, [f.id]: getText(f) })))}+ onClick={() => setEditing(f.id, !editing)}aria-pressed={editing}className="min-h-[36px] inline-flex items-center gap-1 px-2.5 py-1 rounded-lg border border-port-border text-xs text-gray-300 hover:text-white transition-colors">@@ -71,7 +79,7 @@ export default function FailedCaptureList({ failures, getText, getNote, onRetry,<buttontype="button"disabled={f.retrying}- onClick={() => { closeEdit(f.id); onDiscard(f.id); }}+ onClick={() => { forget(f.id); onDiscard(f.id); }}className="min-h-[36px] inline-flex items-center gap-1 px-2.5 py-1 rounded-lg border border-port-border text-xs text-gray-400 hover:text-port-error transition-colors disabled:opacity-50"><Trash2 size={12} aria-hidden="true" /> Discarddiff --git a/client/src/components/brain/tabs/InboxTab.test.jsx b/client/src/components/brain/tabs/InboxTab.test.jsxindex 70d31e5b0f..c52fdbbc63 100644--- a/client/src/components/brain/tabs/InboxTab.test.jsx+++ b/client/src/components/brain/tabs/InboxTab.test.jsx@@ -145,6 +145,9 @@ describe('Brain inbox capture', () => {// Editing the failed row leaves the composer alone; Retry sends the edit once.fireEvent.click(screen.getByRole('button', { name: /^Edit$/ }));fireEvent.change(screen.getByLabelText('Edit unsaved capture'), { target: { value: 'invented thought A, fixed' } });+ // Closing the editor keeps the edit.+ fireEvent.click(screen.getByRole('button', { name: /Done editing/ }));+ expect(screen.getByRole('group', { name: 'Not saved capture' }).textContent).toContain('invented thought A, fixed');fireEvent.click(screen.getByRole('button', { name: /Retry/ }));fireEvent.click(screen.getByRole('button', { name: /Retry|Retrying/ }));diff --git a/client/src/hooks/useFailedCaptures.js b/client/src/hooks/useFailedCaptures.jsindex f829c8b53a..0fe4dee392 100644--- a/client/src/hooks/useFailedCaptures.js+++ b/client/src/hooks/useFailedCaptures.js@@ -15,8 +15,8 @@ import { useCallback, useRef, useState } from 'react';* fail: (payload: object, error: string, id?: string) => string,* markRetrying: (id: string) => boolean,* discard: (id: string) => void,- * }} `fail` adds a row (or, given the `id` of an existing row, refreshes its- * error and clears `retrying`) and returns the row id. `markRetrying` returns+ * }} `fail` adds a row (or, given the `id` of an existing row, replaces its+ * payload and error and clears `retrying`) and returns the row id. `markRetrying` returns* false when that row is already retrying, so a double click sends once.*/export function useFailedCaptures() {@@ -28,7 +28,7 @@ export function useFailedCaptures() {const rowId = id ?? `failed-capture-${++counter.current}`;retryingRef.current.delete(rowId);setFailures((prev) => (prev.some((f) => f.id === rowId)- ? prev.map((f) => (f.id === rowId ? { ...f, error, retrying: false } : f))+ ? prev.map((f) => (f.id === rowId ? { ...f, payload, error, retrying: false } : f)): [{ id: rowId, payload, error, retrying: false }, ...prev]));return rowId;}, []);