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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: keep Music Video load failures visible with retry (#9761)
Adam Eivyc6023d0f85e6
diff --git a/client/src/pages/MusicVideo.jsx b/client/src/pages/MusicVideo.jsxindex 3baa6355d5..d127c0b761 100644--- a/client/src/pages/MusicVideo.jsx+++ b/client/src/pages/MusicVideo.jsx@@ -7,6 +7,7 @@ import toast from '../components/ui/Toast';import ConfirmButtonPair from '../components/ui/ConfirmButtonPair';import { useConfirmDelete } from '../hooks/useConfirmDelete';import PageHeader from '../components/PageHeader';+import Banner from '../components/ui/Banner.jsx';import {listMusicVideoProjects,createMusicVideoProject,@@ -126,6 +127,8 @@ export default function MusicVideo() {const [universes, setUniverses] = useState(null);const selectedId = routeProjectId || null;const [loading, setLoading] = useState(true);+ const [projectsError, setProjectsError] = useState(null);+ const projectsLoadPending = useRef(false);const [analyzing, setAnalyzing] = useState(false);const [arranging, setArranging] = useState(false);const [creativeSetupPending, setCreativeSetupPending] = useState(false);@@ -264,13 +267,27 @@ export default function MusicVideo() {navigate(id ? `/music-video/${id}` : '/music-video');};+ const loadProjects = useCallback(async () => {+ if (projectsLoadPending.current) return;+ projectsLoadPending.current = true;+ setLoading(true);+ try {+ const data = await listMusicVideoProjects({ silent: true });+ setProjects(data || []);+ setProjectsError(null);+ } catch (err) {+ setProjectsError(err?.message || 'Failed to load music video projects');+ } finally {+ projectsLoadPending.current = false;+ setLoading(false);+ }+ }, []);+useEffect(() => {- listMusicVideoProjects({ silent: true })- .then((data) => { setProjects(data || []); setLoading(false); })- .catch((err) => { toast.error(err?.message || 'Failed to load music video projects'); setLoading(false); });+ loadProjects();listTracks({ silent: true }).then((t) => setTracks(t || [])).catch(() => setTracks([]));listUniverseNames({ silent: true }).then((u) => setUniverses(u || [])).catch(() => setUniverses([]));- }, []);+ }, [loadProjects]);const trackName = useCallback((id) => tracks.find((t) => t.id === id)?.title || id || '—', [tracks]);@@ -1047,7 +1064,21 @@ export default function MusicVideo() {/><div>- {!selected && !loading && routeProjectId && (+ {projectsError && (+ <Banner tone="error" size="md" title="Music video projects unavailable" className="mb-4" actions={(+ <button+ type="button"+ onClick={loadProjects}+ disabled={loading}+ className="min-h-[44px] rounded border border-port-error/30 px-3 py-2 text-sm disabled:opacity-50"+ >+ {loading ? 'Retrying…' : 'Retry'}+ </button>+ )}>+ <p>{projectsError}</p>+ </Banner>+ )}+ {!selected && !loading && !projectsError && routeProjectId && (<p className="text-sm text-port-text-muted">Project not found — it may have been deleted.{' '}<button onClick={() => navigate('/music-video')} className="text-port-accent underline">Back to projects</button>@@ -1079,7 +1110,7 @@ export default function MusicVideo() {<div className="text-center py-8 text-sm text-port-text-muted">Loading projects…</div>- ) : projects.length === 0 ? (+ ) : projectsError ? null : projects.length === 0 ? (<div className="text-center py-6 text-sm text-port-text-muted">No music video projects yet. Create your first project above to get started.</div>diff --git a/client/src/pages/MusicVideo.test.jsx b/client/src/pages/MusicVideo.test.jsxindex e00659090f..f9c7400f7d 100644--- a/client/src/pages/MusicVideo.test.jsx+++ b/client/src/pages/MusicVideo.test.jsx@@ -353,6 +353,59 @@ beforeEach(() => {ytSseStates.clear();});+describe('MusicVideo project load recovery (#9761)', () => {+ it.each(['/music-video', '/music-video/mv-2/board'])('keeps failures visible and recovers without changing %s', async (path) => {+ let resolveRetry;+ listMusicVideoProjects+ .mockRejectedValueOnce(new Error('Connection unavailable'))+ .mockRejectedValueOnce(new Error('Still unavailable'))+ .mockImplementationOnce(() => new Promise(resolve => { resolveRetry = resolve; }));+ render(+ <MemoryRouter initialEntries={[path]}>+ <LocationProbe />+ {MV_ROUTES}+ </MemoryRouter>,+ );++ expect(await screen.findByRole('alert')).toHaveTextContent('Connection unavailable');+ expect(screen.queryByText(/No music video projects yet/)).not.toBeInTheDocument();+ expect(screen.queryByText(/Project not found/)).not.toBeInTheDocument();+ expect(screen.getByTestId('loc')).toHaveTextContent(path);+ expect(listMusicVideoProjects).toHaveBeenCalledWith({ silent: true });++ fireEvent.click(screen.getByRole('button', { name: 'Retry' }));+ await waitFor(() => expect(screen.getByRole('alert')).toHaveTextContent('Still unavailable'));+ const retry = screen.getByRole('button', { name: 'Retry' });+ fireEvent.click(retry);+ expect(screen.getByRole('button', { name: 'Retrying…' })).toBeDisabled();+ fireEvent.click(retry);+ expect(listMusicVideoProjects).toHaveBeenCalledTimes(3);+ expect(screen.queryByText(/No music video projects yet/)).not.toBeInTheDocument();+ expect(screen.queryByText(/Project not found/)).not.toBeInTheDocument();++ await act(async () => resolveRetry([PROJECT_NO_CLIP]));+ expect(screen.queryByRole('alert')).not.toBeInTheDocument();+ expect(screen.getByTestId('loc')).toHaveTextContent(path);+ if (path === '/music-video') {+ expect(screen.getByTestId('mv-project-grid')).toHaveTextContent(PROJECT_NO_CLIP.name);+ } else {+ expect(screen.getByRole('heading', { level: 2, name: PROJECT_NO_CLIP.name })).toBeInTheDocument();+ expect(screen.getByRole('tab', { name: /^Board/ })).toHaveAttribute('aria-selected', 'true');+ }+ });++ it.each([+ ['/music-video', /No music video projects yet/],+ ['/music-video/missing-project', /Project not found/],+ ])('shows absence only after a successful read at %s', async (path, message) => {+ listMusicVideoProjects.mockResolvedValue(path === '/music-video' ? [] : [PROJECT_NO_CLIP]);+ render(<MemoryRouter initialEntries={[path]}>{MV_ROUTES}</MemoryRouter>);+ expect(await screen.findByText(message)).toBeInTheDocument();+ expect(screen.queryByRole('alert')).not.toBeInTheDocument();+ expect(screen.queryByRole('button', { name: 'Retry' })).not.toBeInTheDocument();+ });+});+describe('MusicVideo render control (#1760)', () => {it('enables Render and kicks off the job when a scene has a clip', async () => {await openProject(PROJECT_WITH_CLIP, 'review');@@ -2410,4 +2463,3 @@ describe('MusicVideo main page project cards', () => {expect(deleteMusicVideoProject).toHaveBeenCalledWith(PROJECT_WITH_CLIP.id, { silent: true });});});-