fix: resolve HTML hydration error and improve error handling

- Fix HTML structure error: remove nested div inside p element in UploadView
- Restructure ListItemText secondary content to use valid HTML
- Add warning log for upload failures with demo data fallback
- Improve error handling for ERR_CONNECTION_REFUSED
- Ensure proper HTML semantics and prevent hydration errors
This commit is contained in:
Nicolas Cantu 2025-09-10 18:36:57 +02:00
parent e63dccf9f3
commit 7e46e1d992
2 changed files with 21 additions and 20 deletions

View File

@ -49,6 +49,7 @@ export const documentApi = {
})
return data
} catch (error) {
console.warn('Upload failed, using demo data:', error)
// Retourner des données de démonstration en cas d'erreur
return {
id: 'demo-' + Date.now(),

View File

@ -132,6 +132,11 @@ export default function UploadView() {
<ListItemText
primary={doc.name}
secondary={
<Typography component="span" variant="body2" color="text.secondary">
{doc.type} {doc.status} {(doc.size / 1024 / 1024).toFixed(2)} MB
</Typography>
}
/>
<Box sx={{ display: 'flex', gap: 1, mt: 1 }}>
<Chip
label={doc.type}
@ -143,12 +148,7 @@ export default function UploadView() {
size="small"
color={getStatusColor(doc.status) as any}
/>
<Typography variant="caption" color="text.secondary">
{(doc.size / 1024 / 1024).toFixed(2)} MB
</Typography>
</Box>
}
/>
</ListItem>
))}
</List>