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: defer the music-video composition preview until the phone mini-player is expanded
[._.]/ Adam Eivy80f4acfff312
diff --git a/client/src/components/musicVideo/CompositionPreviewPlayer.jsx b/client/src/components/musicVideo/CompositionPreviewPlayer.jsxindex 6122e13b26..5495f3b46f 100644--- a/client/src/components/musicVideo/CompositionPreviewPlayer.jsx+++ b/client/src/components/musicVideo/CompositionPreviewPlayer.jsx@@ -10,6 +10,11 @@ const lyricAt = (cues, t) => {return line?.text || '';};+// A phone's collapsed mini-player has no picture to show, so it must not pull+// every scene take into memory up front — iOS Safari kills the tab and offers+// only "A problem repeatedly occurred". Without matchMedia, load eagerly.+const startsDeferred = (collapsed) => collapsed && window.matchMedia?.('(min-width: 1024px)').matches === false;+/*** Live preview of the project's composition document: the sandboxed iframe,* the song, play/scrub and the lyric line being sung. The iframe runs in an@@ -29,6 +34,8 @@ export default function CompositionPreviewPlayer({ project, audioUrl, seekRequesconst [preview, setPreview] = useState(null);const [previewError, setPreviewError] = useState('');const [status, setStatus] = useState('');+ const [wanted, setWanted] = useState(() => !startsDeferred(collapsed));+ useEffect(() => { if (!collapsed) setWanted(true); }, [collapsed]);const [t, setT] = useState(0);const [playing, setPlaying] = useState(false);const iframeRef = useRef(null);@@ -43,12 +50,12 @@ export default function CompositionPreviewPlayer({ project, audioUrl, seekRequessetPreview(null);setPreviewError('');seekState.current = { inFlight: false, pending: null, ready: false };- if (!refresh) return () => { active = false; };+ if (!refresh || !wanted) return () => { active = false; };getMusicVideoCompositionPreview(project.id, { silent: true, draft }).then((next) => { if (active) setPreview(next); }).catch((err) => { if (active) setPreviewError(err?.message || 'Could not build the preview'); });return () => { active = false; };- }, [project.id, refresh, draft]);+ }, [project.id, refresh, draft, wanted]);const postSeek = useCallback((time) => {const frame = iframeRef.current?.contentWindow;diff --git a/client/src/components/musicVideo/CompositionPreviewPlayer.test.jsx b/client/src/components/musicVideo/CompositionPreviewPlayer.test.jsxindex cdae10fceb..16e205ed8b 100644--- a/client/src/components/musicVideo/CompositionPreviewPlayer.test.jsx+++ b/client/src/components/musicVideo/CompositionPreviewPlayer.test.jsx@@ -45,6 +45,21 @@ describe('CompositionPreviewPlayer', () => {expect(screen.queryByText(/Loading preview media/)).not.toBeInTheDocument();});+ it('does not build the preview behind a collapsed phone mini-player until it is expanded', async () => {+ const original = window.matchMedia;+ window.matchMedia = vi.fn(() => ({ matches: false }));+ try {+ const { rerender } = render(<CompositionPreviewPlayer project={project} audioUrl={null} collapsed />);+ await act(async () => {});+ expect(api.getMusicVideoCompositionPreview).not.toHaveBeenCalled();+ rerender(<CompositionPreviewPlayer project={project} audioUrl={null} collapsed={false} />);+ await screen.findByTitle('Composition document preview');+ expect(api.getMusicVideoCompositionPreview).toHaveBeenCalledTimes(1);+ } finally {+ window.matchMedia = original;+ }+ });+it('runs the document in an opaque-origin sandbox and renders nothing without one', async () => {const { container, rerender } = render(<CompositionPreviewPlayer project={{ ...project, composition: { mode: 'document' } }} audioUrl={null} />);expect(container).toBeEmptyDOMElement();