diff --git a/services/web-ui/public/screens-editor.jsx b/services/web-ui/public/screens-editor.jsx index dd57171..671d59f 100644 --- a/services/web-ui/public/screens-editor.jsx +++ b/services/web-ui/public/screens-editor.jsx @@ -40,6 +40,7 @@ function Editor() { const historyIdxRef = React.useRef(0); const currentSeqRef = React.useRef(null); const isDirtyRef = React.useRef(false); + const assetsRef = React.useRef([]); React.useEffect(() => { const data = window.ZAMPP_DATA; @@ -52,6 +53,7 @@ function Editor() { React.useEffect(() => { currentSeqRef.current = currentSeq; }, [currentSeq]); React.useEffect(() => { isDirtyRef.current = isDirty; }, [isDirty]); + React.useEffect(() => { assetsRef.current = assets; }, [assets]); React.useEffect(() => { const refreshAssets = function() { @@ -202,7 +204,7 @@ function Editor() { const parsed = JSON.parse(raw); assetId = parsed.assetId || parsed.id || assetId; } catch (_) {} - const asset = assets.find(function(a) { return a.id === assetId; }); + const asset = assetsRef.current.find(function(a) { return a.id === assetId; }); if (!asset) return; let streamUrl = streamCacheRef.current[asset.id]; if (!streamUrl) { @@ -573,7 +575,7 @@ function ClipContextMenu({ clip, x, y, onClose, onOpenSource, onDuplicate, onSpl function ProgramMonitor({ videoRef, currentSeq, playheadFrames, setPlayheadFrames, streamCacheRef }) { const [pgmPlaying, setPgmPlaying] = React.useState(false); const [pgmClipIdx, setPgmClipIdx] = React.useState(-1); - const [pgmClips, setPgmClips] = React.useState([]); + const [pgmClips, setPgMclips] = React.useState([]); function getV1Clips() { if (!currentSeq || !currentSeq.clips) return []; @@ -587,7 +589,7 @@ function ProgramMonitor({ videoRef, currentSeq, playheadFrames, setPlayheadFrame } const v1 = getV1Clips(); if (!v1.length) return; - setPgmClips(v1); + setPgMclips(v1); const idx = v1.findIndex(c => playheadFrames >= c.timeline_in_frames && playheadFrames < c.timeline_out_frames); setPgmClipIdx(idx >= 0 ? idx : 0); setPgmPlaying(true); @@ -681,4 +683,4 @@ function EditorKeyboard({ onUndo, onRedo, onSave, onMarkIn, onMarkOut, currentSe return null; } -window.Editor = Editor; +window.Editor = Editor; \ No newline at end of file