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: toast variation render failures + cap optimistic imageRefs

[._.]/ Adam Eivyce179a92766e
diff --git a/client/src/components/universe/UniverseCanonSection.jsx b/client/src/components/universe/UniverseCanonSection.jsx
index fb812ff72b..c1ccc5dd5f 100644
--- a/client/src/components/universe/UniverseCanonSection.jsx
+++ b/client/src/components/universe/UniverseCanonSection.jsx
@@ -37,6 +37,13 @@ import MediaPreview from '../media/MediaPreview';
import { pipelineImageCfgToRenderOpts } from '../../lib/pipelineImageDefaults';
import { universeStylePreset } from '../../lib/universeStylePreset';
import { descriptorForCanonEntry } from '../../lib/canonPrompt';
+import { BIBLE_LIMITS } from '../../lib/bibleLimits';
+
+const capImageRefs = (refs) => (
+ refs.length > BIBLE_LIMITS.IMAGE_REFS_PER_ENTRY_MAX
+ ? refs.slice(-BIBLE_LIMITS.IMAGE_REFS_PER_ENTRY_MAX)
+ : refs
+);
const KINDS = [
{
@@ -450,7 +457,11 @@ export default function UniverseCanonSection({
if (e?.id !== entryId) return e;
const refs = Array.isArray(e.imageRefs) ? e.imageRefs : [];
if (refs.includes(filename)) return e;
- return { ...e, imageRefs: [...refs, filename] };
+ // Mirror the server-side appendEntryImageRef cap (last N wins) so
+ // an external batch completion arriving at a full row doesn't leave
+ // the optimistic state holding an overlong array that a subsequent
+ // save would have to trim.
+ return { ...e, imageRefs: capImageRefs([...refs, filename]) };
});
onUniverseChange({ ...latest, [kindKey]: nextList });
}, [onUniverseChange]);
diff --git a/client/src/pages/UniverseBuilder.jsx b/client/src/pages/UniverseBuilder.jsx
index b40aff358c..5795ee71ff 100644
--- a/client/src/pages/UniverseBuilder.jsx
+++ b/client/src/pages/UniverseBuilder.jsx
@@ -47,6 +47,17 @@ import { PIPELINE_IMAGE_DEFAULTS, readPipelineImageSettings } from '../lib/pipel
import { normalizeSlugline } from '../lib/scenePrompt';
import { hasCanonDescriptorContent } from '../lib/canonPrompt';
import { upsertByIdPrepend } from '../lib/upsertByIdPrepend';
+import { BIBLE_LIMITS } from '../lib/bibleLimits';
+
+// Mirror of server-side appendEntryImageRef cap (most recent N wins). Used
+// so optimistic on-completion appends produce the same final array shape
+// the server would, preventing a brief window where a save round-trip
+// could reorder the visible thumbnails.
+const capImageRefs = (refs) => (
+ refs.length > BIBLE_LIMITS.IMAGE_REFS_PER_ENTRY_MAX
+ ? refs.slice(-BIBLE_LIMITS.IMAGE_REFS_PER_ENTRY_MAX)
+ : refs
+);
const CATEGORY_LABELS = {
landscapes: 'Landscapes',
@@ -1988,7 +1999,7 @@ export default function UniverseBuilder() {
if (v.id !== entryId) return v;
const refs = Array.isArray(v.imageRefs) ? v.imageRefs : [];
if (refs.includes(filename)) return v;
- return { ...v, imageRefs: [...refs, filename] };
+ return { ...v, imageRefs: capImageRefs([...refs, filename]) };
});
return { ...d, categories: { ...d.categories, [bucket]: { ...cat, variations } } };
});
@@ -2051,7 +2062,7 @@ export default function UniverseBuilder() {
if (v.id !== entryId) return v;
const refs = Array.isArray(v.imageRefs) ? v.imageRefs : [];
if (refs.includes(filename)) return v;
- return { ...v, imageRefs: [...refs, filename] };
+ return { ...v, imageRefs: capImageRefs([...refs, filename]) };
});
return { ...d, categories: { ...d.categories, [bucket]: { ...cat, variations } } };
});
@@ -3440,7 +3451,15 @@ export function TrunkView({
pendingByEntryId={pendingByEntryId}
onJobCompleted={(entryId, filename, completedJobId) =>
onJobCompletedForEntry?.(entryId, filename, cat, completedJobId)}
- onJobFailed={(entryId, _err, failedJobId) => onPendingCleared?.(entryId, failedJobId)}
+ onJobFailed={(entryId, err, failedJobId) => {
+ // Toast BEFORE clearing — clearing removes the
+ // MediaJobThumb from the row and the failure state
+ // disappears with it. Without the toast, a failed
+ // variation render collapses silently to the empty
+ // thumbnail (mirrors UniverseCanonSection.onJobFailed).
+ if (err) toast.error(`Render failed: ${typeof err === 'string' ? err : (err.message || err)}`);
+ onPendingCleared?.(entryId, failedJobId);
+ }}
/>
))}
</section>
@@ -3510,7 +3529,13 @@ export function OtherTab({
pendingByEntryId={pendingByEntryId}
onJobCompleted={(entryId, filename, completedJobId) =>
onJobCompletedForEntry?.(entryId, filename, cat, completedJobId)}
- onJobFailed={(entryId, _err, failedJobId) => onPendingCleared?.(entryId, failedJobId)}
+ onJobFailed={(entryId, err, failedJobId) => {
+ // Same surface-then-clear order as the Trunk-tab handler above:
+ // MediaJobThumb is unmounted on clear, so the toast must fire
+ // first or the user gets no signal that the render failed.
+ if (err) toast.error(`Render failed: ${typeof err === 'string' ? err : (err.message || err)}`);
+ onPendingCleared?.(entryId, failedJobId);
+ }}
/>
))}
</section>