fix
This commit is contained in:
parent
b93c051d5f
commit
ed00b742a1
|
|
@ -136,13 +136,19 @@ function DocumentList({
|
||||||
});
|
});
|
||||||
}, [documents]);
|
}, [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(() => {
|
useEffect(() => {
|
||||||
return () => {
|
return () => {
|
||||||
Object.values(previews).forEach((url) => window.URL.revokeObjectURL(url));
|
Object.values(previews).forEach((url) => window.URL.revokeObjectURL(url));
|
||||||
|
};
|
||||||
|
}, [previews]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
return () => {
|
||||||
Object.values(videoUrls).forEach((url) => window.URL.revokeObjectURL(url));
|
Object.values(videoUrls).forEach((url) => window.URL.revokeObjectURL(url));
|
||||||
};
|
};
|
||||||
}, []);
|
}, [videoUrls]);
|
||||||
|
|
||||||
const handleDownload = (doc: DocumentItem) => {
|
const handleDownload = (doc: DocumentItem) => {
|
||||||
const cached = previews[doc.id] || videoUrls[doc.id];
|
const cached = previews[doc.id] || videoUrls[doc.id];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue