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

refactor([wardroberow-migrate-to-userowdraft]): trim narrating comments, simplify name check

[._.]/ Adam Eivy1f42c5eba8ca
diff --git a/PLAN.md b/PLAN.md
index 01adc17428..24254d871f 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -71,6 +71,7 @@ _Nothing currently parked — pick the next item from the Backlog._
- [ ] [useasyncaction-post-unmount-setstate-guard-add] **`useAsyncAction` post-unmount setState guard.** Add `mountedRef` to gate `setRunning(false)`. YAGNI today; do at 4th consumer.
- [ ] [scene-level-wardrobe-picking-per-scene] **Scene-level wardrobe picking.** Per-scene `characterAppearances: [{ characterId, wardrobeId? }]` on storyboard scenes with wardrobe-picker dropdown. Decide first: does the extractor guess or does the user pick? Append wardrobe after physicalDescription vs substitute body fields?
- [ ] [extract-usecanonpatch-universe-setuniverse] **Extract `useCanonPatch(universe, setUniverse, universeId, mountedRef)`.** `UniverseCanon.jsx` + `NounsStage.jsx` 95% identical optimistic-patch handlers. Extract when a 3rd caller appears.
+- [ ] [extract-usependinglistrows-hook] **Extract `usePendingListRows({ persisted, requiredColumn, idPrefix, onChange }) → { merged, isPending, addRow, updateRow, removeRow }`.** Surfaced by /simplify during `[wardroberow-migrate-to-userowdraft]`. `WardrobeSection` in `client/src/components/pipeline/CanonCard.jsx:155-211` and `CharacterDetailEditor` list-section block in `client/src/components/universe/CharacterDetailEditor.jsx:202-278` now share substantial structure: pending rows held client-side until a required column fills, then promoted to `onChange`/`patchList`, with an index space that concatenates `[...persisted, ...pending]` and an `isPending(idx)` partition. Estimated ~70 LOC savings across both call sites. Two load-bearing details to preserve in the extraction: (1) `WardrobeSection` mints `wd-<uuid>` ids that round-trip verbatim; `CharacterDetailEditor` mints `pending-<key>-<uuid>` that get stripped at promotion — pass an `idPrefix` and a `stripIdOnPromote` flag (or unify both onto server-shaped ids and drop the strip); (2) hook is per-list (one instance per `LIST_SECTION` in `CharacterDetailEditor`, one in `WardrobeSection`), NOT per-component. Deferred to keep this PR focused on the `useRowDraft` migration; revisit when a third caller appears or the parallel divergence drifts.
- [ ] [client-tests-for-deep-routing-drag-smoke-tests-for] **Client tests for deep routing + drag.** Smoke tests for `goToWorld(id)` URL transitions and chip-reorder ordering (mock `useSortable`).
- [ ] [shallow-equal-guard-in-usemediaannotations-socket] **Shallow-equal guard in `useMediaAnnotations` socket handler.** Speculative micro-opt; theoretical until observed.
- [ ] [sweep-provider-type-tui-inline-checks-in-client] **Sweep `provider.type === 'tui'` inline checks in client.** New `isTuiProvider` helper in `client/src/utils/providers.js` not yet adopted in `client/src/pages/AIProviders.jsx` (3 remaining inline checks at lines 262, 396, 421 of CONFIG-style chips) and `client/src/components/cos/TaskAddForm.jsx`. Low priority — these are visual chip predicates, not behavioral.
diff --git a/client/src/components/pipeline/CanonCard.jsx b/client/src/components/pipeline/CanonCard.jsx
index f73b2cb59a..9521e5ca6a 100644
--- a/client/src/components/pipeline/CanonCard.jsx
+++ b/client/src/components/pipeline/CanonCard.jsx
@@ -96,11 +96,7 @@ function SourceSeriesChip({ sourceSeriesId, seriesName }) {
);
}
-// One wardrobe row — multi-column draft+blur with sibling ride-along lives in
-// `useRowDraft`. Committing column B while column A still has a pending draft
-// ships BOTH in one `onCommit(nextRow)` call, so a fast desc-blur right after
-// a name keystroke can't drop the name. The parent decides between patching
-// an existing row vs promoting a pending one based on the required column.
+// Parent decides patch-vs-promote on `nextRow.name` non-empty; see `useRowDraft`.
function WardrobeRow({ wardrobe, editable, onCommit, onRemove }) {
const { draftFor, setDraft, commit } = useRowDraft(wardrobe, onCommit);
if (!editable) {
@@ -172,13 +168,11 @@ function WardrobeSection({ wardrobes, editable, onChange }) {
const commit = (idx, nextRow) => {
if (isPending(idx)) {
const pendingIdx = idx - wardrobes.length;
- // Promote on name-non-empty. The pending row already carries a
- // server-shaped `wd-<uuid>` id (minted client-side in `addOne`) so
- // it persists verbatim — and crucially, the React key stays stable
- // across promotion so the `WardrobeRow` instance doesn't unmount
- // and lose any pending sibling draft buffered inside its
- // `useRowDraft` hook.
- if (String(nextRow.name || '').trim()) {
+ // Stable React key across promotion — `w.id` was minted server-shaped
+ // in `addOne` so it round-trips verbatim, which keeps `WardrobeRow`
+ // mounted across the pending → persisted swap and preserves any
+ // in-flight sibling draft in its `useRowDraft` buffer.
+ if (nextRow.name?.trim()) {
setPendingNew(pendingNew.filter((_, i) => i !== pendingIdx));
onChange([...wardrobes, nextRow]);
} else {