diff --git a/typescript/frontend-marios2/src/components/DocumentList.tsx b/typescript/frontend-marios2/src/components/DocumentList.tsx index 9c92b589e..51e44e2c6 100644 --- a/typescript/frontend-marios2/src/components/DocumentList.tsx +++ b/typescript/frontend-marios2/src/components/DocumentList.tsx @@ -136,13 +136,19 @@ function DocumentList({ }); }, [documents]); - // Clean up blob URLs on unmount + // Revoke superseded blob URLs as state changes, and on unmount. + // Empty deps would capture the initial {} and never revoke anything. useEffect(() => { return () => { Object.values(previews).forEach((url) => window.URL.revokeObjectURL(url)); + }; + }, [previews]); + + useEffect(() => { + return () => { Object.values(videoUrls).forEach((url) => window.URL.revokeObjectURL(url)); }; - }, []); + }, [videoUrls]); const handleDownload = (doc: DocumentItem) => { const cached = previews[doc.id] || videoUrls[doc.id];