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 [error, setError] = useState<string | null>(null);
|
||||||
const [savedMsg, setSavedMsg] = 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 [previews, setPreviews] = useState<LocalPreview[]>([]);
|
||||||
const [uploading, setUploading] = useState(false);
|
const [uploading, setUploading] = useState(false);
|
||||||
|
|
||||||
// ✅ avoid object URL leaks
|
// avoid object URL leaks
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
return () => {
|
return () => {
|
||||||
previews.forEach((p) => URL.revokeObjectURL(p.url));
|
previews.forEach((p) => URL.revokeObjectURL(p.url));
|
||||||
};
|
};
|
||||||
}, [previews]);
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, []);
|
||||||
|
|
||||||
const authed = !!token;
|
const authed = !!token;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user