@@ -1,3 +1,4 @@
|
||||
import { createObjectUrlLease } from "@add-ideas/toolbox-helpers";
|
||||
import { useEffect, useRef } from "react";
|
||||
import type { ArchiveEntryRecord, PreviewResult } from "../../archive/types";
|
||||
|
||||
@@ -16,11 +17,11 @@ export function PreviewPane({
|
||||
useEffect(() => {
|
||||
const node = image.current;
|
||||
if (!node || preview?.kind !== "image") return;
|
||||
const url = URL.createObjectURL(preview.blob);
|
||||
node.src = url;
|
||||
const lease = createObjectUrlLease(preview.blob);
|
||||
node.src = lease.url;
|
||||
return () => {
|
||||
node.removeAttribute("src");
|
||||
URL.revokeObjectURL(url);
|
||||
lease.revoke();
|
||||
};
|
||||
}, [preview]);
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user