fix: missing previews

This commit is contained in:
Ibrahima G. Coulibaly
2025-05-22 17:18:36 +01:00
parent 6af2957314
commit 0a68edfbad
3 changed files with 18 additions and 12 deletions

View File

@@ -33,17 +33,14 @@ export default function BaseFileInput({
const { showSnackBar } = useContext(CustomSnackBarContext);
useEffect(() => {
try {
if (isArray(value)) {
const objectUrl = createObjectURL(value[0]);
if (value) {
try {
const objectUrl = createObjectURL(value);
setPreview(objectUrl);
return () => revokeObjectURL(objectUrl);
} else {
setPreview(null);
} catch (error) {
console.error('Error previewing file:', error);
}
} catch (error) {
console.error('Error previewing file:', error);
}
}, [value]);