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 (claude): distinguish loading from unavailable, fix note desync

Adam Eivyf1b988070ea8
diff --git a/PLAN.md b/PLAN.md
index e9b30ca3ca..e1c752d1f0 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -219,4 +219,5 @@ by `/do:replan --issues`:
### Creative Commission detail-page follow-ups
- [ ] **Resolve a commission's render projects without pulling the whole CD project list.** `client/src/pages/CreativeCommissionDetail.jsx` fetches `listCreativeDirectorProjects()` (every project, non-slim) on load just to index the ≤50 referenced by `runs[].projectId`. It's a single request and matches how the CD list page already loads, but it scales with the install's *total* project count, not the commission's. Once a by-id/batch resolver exists (see the `useVideoFileSrc` follow-up above — same "no by-id endpoint" root cause), swap this to fetch only the referenced projects. Deferred from the detail-page PR to avoid adding a server endpoint in a client-only change.
+- [ ] **Live-update a commission's freshly-run render instead of asking the user to reload.** After "Run now" on `CreativeCommissionDetail.jsx`, the new run appears immediately as a "no render yet" card, but the CD project generates asynchronously and nothing on the open page refetches when it completes — the render only materializes on a `location.key` refetch (navigation / notification deep-link), so the toast tells the user to reload. Fix once the CD project exposes a completion signal the page can subscribe to (socket event or a lightweight poll of the referenced projects while any run is `started`), then drop the "reload to refresh" clause from the toast. Deferred from the detail-page PR: it needs a CD-generation-completion subscription the page doesn't have today, and the render still arrives correctly on the next navigation in the meantime.
- [ ] **Consider extracting the shared run-now/pause/delete commission actions.** The `handleRunNow` / `toggleEnabled` / `handleDelete` handlers now live in both `CreativeCommissions.jsx` (list state — `setCommissions` map/filter) and `CreativeCommissionDetail.jsx` (single-record state — `setCommission`). Two occurrences with genuinely different state shapes, so the rule of three isn't met and a `useCommissionActions` hook would need to abstract over both shapes awkwardly; left as-is. Revisit if a third surface (e.g. a dashboard widget) needs the same actions.
diff --git a/client/src/components/creative-commission/RenderHistory.jsx b/client/src/components/creative-commission/RenderHistory.jsx
index 7f2bca65c3..9f34f4400b 100644
--- a/client/src/components/creative-commission/RenderHistory.jsx
+++ b/client/src/components/creative-commission/RenderHistory.jsx
@@ -28,7 +28,7 @@ const STATUS_CLASS = {
failed: 'text-port-error',
};
-export default function RenderHistory({ runs, feedback, projectsById, onRate }) {
+export default function RenderHistory({ runs, feedback, projectsById, projectsLoading, onRate }) {
// Newest-first, memoized so the copy+reverse doesn't run on every render.
const orderedRuns = useMemo(() => [...(runs || [])].reverse(), [runs]);
// Latest reaction per run (last write wins), so the run reflects its most
@@ -62,10 +62,12 @@ export default function RenderHistory({ runs, feedback, projectsById, onRate })
<ProjectPreview project={project} to={`/creative-director/${encodeURIComponent(r.projectId)}`} />
) : (
// `project` is null in this branch, so the placeholder falls back to
- // the default 16:9 box — a status-only card for a pruned/missing render.
+ // the default 16:9 box. Distinguish the transient load window (project
+ // list still fetching) from a genuinely pruned/missing render — a real
+ // render must not flash "unavailable" before the fetch resolves.
<div className={`${previewAspectClass()} bg-port-bg flex flex-col items-center justify-center gap-1 text-gray-600 text-xs`}>
<Film className="w-4 h-4 opacity-50" aria-hidden="true" />
- <span>{r.projectId ? 'render unavailable' : 'no render'}</span>
+ <span>{r.projectId ? (projectsLoading ? 'loading…' : 'render unavailable') : 'no render'}</span>
</div>
)}
@@ -92,10 +94,19 @@ export default function RenderHistory({ runs, feedback, projectsById, onRate })
</Link>
)}
- {/* Rate/annotate — pushed to the bottom of the card so cards align. */}
+ {/* Rate/annotate — pushed to the bottom of the card so cards align.
+ Keyed on the persisted reaction's timestamp so an externally-changed
+ note (a federated rating from another machine, arriving via a refetch)
+ remounts the control and re-seeds its local note, instead of leaving a
+ stale empty field that a Save could clobber the peer's note with. */}
{r.projectId && onRate && (
<div className="mt-auto pt-1">
- <RunFeedback runId={r.id} current={feedbackByRun[r.id]} onRate={onRate} />
+ <RunFeedback
+ key={feedbackByRun[r.id]?.at || 'unrated'}
+ runId={r.id}
+ current={feedbackByRun[r.id]}
+ onRate={onRate}
+ />
</div>
)}
</div>
diff --git a/client/src/pages/CreativeCommissionDetail.jsx b/client/src/pages/CreativeCommissionDetail.jsx
index 930b882385..4797c2c0ef 100644
--- a/client/src/pages/CreativeCommissionDetail.jsx
+++ b/client/src/pages/CreativeCommissionDetail.jsx
@@ -40,6 +40,7 @@ export default function CreativeCommissionDetail() {
const [saving, setSaving] = useState(false);
const [running, setRunning] = useState(false);
const [projectsById, setProjectsById] = useState(() => new Map());
+ const [projectsLoading, setProjectsLoading] = useState(false);
const { isConfirming, requestDelete, cancelDelete, confirmDelete } = useConfirmDelete();
// Load (and refresh) the deep-linked commission. `location.key` is a dep so a
@@ -81,9 +82,10 @@ export default function CreativeCommissionDetail() {
}, [commission]);
useEffect(() => {
- if (!projectIdsKey) { setProjectsById(new Map()); return; }
+ if (!projectIdsKey) { setProjectsById(new Map()); setProjectsLoading(false); return; }
const wanted = new Set(projectIdsKey.split(','));
let cancelled = false;
+ setProjectsLoading(true);
listCreativeDirectorProjects()
.then((projects) => {
if (cancelled) return;
@@ -93,7 +95,8 @@ export default function CreativeCommissionDetail() {
}
setProjectsById(map);
})
- .catch(() => { /* status-only cards degrade gracefully */ });
+ .catch(() => { /* status-only cards degrade gracefully */ })
+ .finally(() => { if (!cancelled) setProjectsLoading(false); });
return () => { cancelled = true; };
}, [projectIdsKey]);
@@ -148,7 +151,7 @@ export default function CreativeCommissionDetail() {
const fresh = result.commission;
setCommission((prev) => (prev ? { ...prev, runs: fresh.runs, feedback: fresh.feedback } : fresh));
}
- if (result?.status === 'started') toast.success('Run started — the render will appear below');
+ if (result?.status === 'started') toast.success('Run started — its render appears below once generation finishes (reload to refresh)');
else if (result?.status === 'skipped') toast.error(`Run skipped: ${result.reason}`);
else toast.error(`Run failed: ${result?.error || 'unknown error'}`);
} catch (e) {
@@ -263,6 +266,7 @@ export default function CreativeCommissionDetail() {
runs={commission.runs}
feedback={commission.feedback}
projectsById={projectsById}
+ projectsLoading={projectsLoading}
onRate={handleRate}
/>
</section>