mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 12:51:14 -05:00
Improve form validation and image handling for entities
Refactor validation logic for 'founded_year' in multiple form components, enhance image cleanup in `EntityMultiImageUploader`, update `useEntityVersions` to prevent race conditions, improve error handling for recent searches in `useSearch`, refine rate limiting logic in `detect-location` Supabase function, and update CORS configuration for `upload-image` Supabase function. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b9af4867-23a7-43cc-baeb-4a97f66b4150 Replit-Commit-Checkpoint-Type: intermediate_checkpoint
This commit is contained in:
@@ -57,6 +57,24 @@ export function EntityMultiImageUploader({
|
||||
}
|
||||
}, [mode, entityId, entityType]);
|
||||
|
||||
// Cleanup blob URLs when component unmounts or images change
|
||||
useEffect(() => {
|
||||
const currentImages = value.uploaded;
|
||||
|
||||
return () => {
|
||||
// Revoke all blob URLs on cleanup
|
||||
currentImages.forEach(image => {
|
||||
if (image.isLocal && image.url.startsWith('blob:')) {
|
||||
try {
|
||||
URL.revokeObjectURL(image.url);
|
||||
} catch (error) {
|
||||
console.error('Error revoking object URL:', error);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
}, [value.uploaded]);
|
||||
|
||||
const fetchEntityPhotos = async () => {
|
||||
setLoadingPhotos(true);
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user