fix possible mem leaks on photos

This commit is contained in:
2025-12-21 07:40:45 -05:00
parent 856b99b933
commit 13edcdce69
+4 -3
View File
@@ -59,16 +59,17 @@ export default function VaultBuildEditPage() {
const [error, setError] = useState<string | null>(null);
const [savedMsg, setSavedMsg] = useState<string | null>(null);
// photo upload UI state
// photo upload UI state
const [previews, setPreviews] = useState<LocalPreview[]>([]);
const [uploading, setUploading] = useState(false);
// avoid object URL leaks
// avoid object URL leaks
useEffect(() => {
return () => {
previews.forEach((p) => URL.revokeObjectURL(p.url));
};
}, [previews]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const authed = !!token;