fix possible mem leaks on photos
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user