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: scope episode storyboard links to the loaded episode

[._.]/ Adam Eivy3ea2350cd2d0
diff --git a/client/src/components/fableloom/LoomBoard.jsx b/client/src/components/fableloom/LoomBoard.jsx
index 5b52b59c47..890f4fe760 100644
--- a/client/src/components/fableloom/LoomBoard.jsx
+++ b/client/src/components/fableloom/LoomBoard.jsx
@@ -24,12 +24,14 @@ const thumb = (image) => `/data/images/${encodeURIComponent(image)}`;
export default function LoomBoard({ loomId, episode, aspectRatio, via, onPick, onOpenNode }) {
const navigate = useNavigate();
const path = useMemo(() => fableLoomBoardPath(episode, via), [episode, via]);
- const [boards, setBoards] = useState([]);
+ const [boardList, setBoardList] = useState(null);
+ const boards = boardList?.loomId === loomId && boardList?.episodeId === episode.id ? boardList.rows : [];
const [making, setMaking] = useState(false);
useEffect(() => {
let active = true;
listStoryboards({ silent: true })
- .then((rows) => { if (active) setBoards((rows || []).filter((b) => b.source?.loomId === loomId && b.source?.episodeId === episode.id)); })
+ .then((rows) => { if (active) setBoardList({ loomId, episodeId: episode.id,
+ rows: (rows || []).filter((b) => b.source?.loomId === loomId && b.source?.episodeId === episode.id) }); })
.catch(() => {});
return () => { active = false; };
}, [loomId, episode.id]);
diff --git a/client/src/components/fableloom/LoomBoard.test.jsx b/client/src/components/fableloom/LoomBoard.test.jsx
new file mode 100644
index 0000000000..4b6129317f
--- /dev/null
+++ b/client/src/components/fableloom/LoomBoard.test.jsx
@@ -0,0 +1,23 @@
+import { act, render, screen } from '@testing-library/react';
+import { MemoryRouter } from 'react-router';
+import { expect, it, vi } from 'vitest';
+import LoomBoard from './LoomBoard';
+
+const api = vi.hoisted(() => ({ listStoryboards: vi.fn(), makeStoryboardFromFableLoom: vi.fn() }));
+vi.mock('../../services/api', () => api);
+vi.mock('../MediaImage', () => ({ default: () => null }));
+
+it('does not show another episode’s storyboard links while the current list is unavailable', async () => {
+ const episode = id => ({ id, startNodeId: 'node-1', nodes: [{ id: 'node-1', title: 'An ending', isEnding: true, transitions: [] }] });
+ const props = { loomId: 'loom-1', aspectRatio: '16:9', via: [], onPick: vi.fn(), onOpenNode: vi.fn() };
+ api.listStoryboards.mockResolvedValueOnce([
+ { id: 'sb-first', name: 'First episode board', source: { kind: 'fableloom', loomId: 'loom-1', episodeId: 'ep-1' } },
+ ]);
+ let failRead;
+ api.listStoryboards.mockImplementationOnce(() => new Promise((_, reject) => { failRead = reject; }));
+ const view = render(<MemoryRouter><LoomBoard {...props} episode={episode('ep-1')} /></MemoryRouter>);
+ expect(await screen.findByRole('link', { name: 'First episode board' })).toBeInTheDocument();
+ view.rerender(<MemoryRouter><LoomBoard {...props} episode={episode('ep-2')} /></MemoryRouter>);
+ await act(async () => { failRead(new Error('List unavailable')); });
+ expect(screen.queryByRole('link', { name: 'First episode board' })).not.toBeInTheDocument();
+});