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

fix: distinguish catalog cast read failures from empty results (#8280)

[._.]/ Adam Eivy1f44e4b9bb56
diff --git a/client/src/components/CatalogCastPanel.jsx b/client/src/components/CatalogCastPanel.jsx
index 5e849ce157..addfa54071 100644
--- a/client/src/components/CatalogCastPanel.jsx
+++ b/client/src/components/CatalogCastPanel.jsx
@@ -34,6 +34,8 @@ function snippet(payload) {
export default function CatalogCastPanel({ refKind, refId, refLabel }) {
const [rows, setRows] = useState([]);
const [loading, setLoading] = useState(true);
+ const [loadError, setLoadError] = useState(false);
+ const [reloadKey, setReloadKey] = useState(0);
const [pickerOpen, setPickerOpen] = useState(false);
const [busyId, setBusyId] = useState(null);
@@ -41,6 +43,7 @@ export default function CatalogCastPanel({ refKind, refId, refLabel }) {
if (!refId) return undefined;
let cancelled = false;
setLoading(true);
+ setLoadError(false);
listCatalogIngredientsForRef(refKind, refId, { silent: true })
.then((data) => {
if (cancelled) return;
@@ -50,10 +53,11 @@ export default function CatalogCastPanel({ refKind, refId, refLabel }) {
if (cancelled) return;
toast.error(err.message || 'Failed to load catalog cast');
setRows([]);
+ setLoadError(true);
})
.finally(() => { if (!cancelled) setLoading(false); });
return () => { cancelled = true; };
- }, [refKind, refId]);
+ }, [refKind, refId, reloadKey]);
const handlePicked = async (picked) => {
const ingredient = Array.isArray(picked) ? picked[0] : picked;
@@ -118,6 +122,17 @@ export default function CatalogCastPanel({ refKind, refId, refLabel }) {
<Loader2 size={12} className="animate-spin" aria-hidden="true" />
Loading cast…
</div>
+ ) : loadError ? (
+ <div role="alert" className="flex flex-wrap items-center gap-2 text-xs text-port-error">
+ <span>Couldn't load linked catalog ingredients.</span>
+ <button
+ type="button"
+ onClick={() => setReloadKey((current) => current + 1)}
+ className="min-h-[44px] px-2 rounded underline underline-offset-2"
+ >
+ Retry
+ </button>
+ </div>
) : rows.length === 0 ? (
<p className="text-xs text-gray-500 italic">
No catalog ingredients linked yet. Click Add to pick from the Catalog{labelSuffix}.
diff --git a/client/src/components/CatalogCastPanel.test.jsx b/client/src/components/CatalogCastPanel.test.jsx
index 490d9ac4c7..e6f51fee43 100644
--- a/client/src/components/CatalogCastPanel.test.jsx
+++ b/client/src/components/CatalogCastPanel.test.jsx
@@ -46,6 +46,31 @@ describe('CatalogCastPanel', () => {
expect(screen.getByText(/for Test Series/i)).toBeTruthy();
});
+ it('shows list-read failures separately and retries the same record', async () => {
+ listCatalogIngredientsForRef
+ .mockRejectedValueOnce(new Error('Network unavailable'))
+ .mockResolvedValueOnce([
+ {
+ ingredient: { id: 'i-3', name: 'Example Character', type: 'character', payload: {} },
+ role: 'cast-character',
+ },
+ ]);
+ renderPanel();
+
+ await waitFor(() => {
+ expect(screen.getByText("Couldn't load linked catalog ingredients.")).toBeTruthy();
+ });
+ expect(screen.queryByText(/No catalog ingredients linked yet/i)).toBeNull();
+
+ fireEvent.click(screen.getByRole('button', { name: 'Retry' }));
+
+ await waitFor(() => {
+ expect(screen.getByText('Example Character')).toBeTruthy();
+ });
+ expect(listCatalogIngredientsForRef).toHaveBeenNthCalledWith(1, 'series', 'series-1', { silent: true });
+ expect(listCatalogIngredientsForRef).toHaveBeenNthCalledWith(2, 'series', 'series-1', { silent: true });
+ });
+
it('renders rows from the fetched list', async () => {
listCatalogIngredientsForRef.mockResolvedValue([
{