fix: photos lost on save, multi-upload only kept last file, thumbnails 400

recipe-form/API routes were never sending/persisting photos on create+update.
PhotoUploader accumulated uploads via a stale closure over the photos prop, so
only the last file of a multi-select survived. Once both were fixed, thumbnails
still 400'd because Next's image optimizer blocks upstream hosts resolving to
private/loopback IPs (localhost:9000 MinIO) — skip optimization for
storage-hosted photos since they're already web-sized user uploads.
This commit is contained in:
Arnaud
2026-07-12 13:16:37 +02:00
parent 77f43ee673
commit 546ba98d2f
12 changed files with 68 additions and 6 deletions
+2
View File
@@ -339,6 +339,7 @@ export default async function RecipePage({ params }: Params) {
<div className="relative aspect-video overflow-hidden rounded-xl bg-muted">
<Image
src={getPublicUrl(cover.storageKey)}
unoptimized
alt={recipe.title}
fill
className="object-cover"
@@ -442,6 +443,7 @@ export default async function RecipePage({ params }: Params) {
<div key={photo.id} className="relative aspect-square rounded-lg overflow-hidden bg-muted">
<Image
src={getPublicUrl(photo.storageKey)}
unoptimized
alt={`${recipe.title} photo ${i + 1}`}
fill
className="object-cover"
+1
View File
@@ -240,6 +240,7 @@ export default async function UserProfilePage({ params, searchParams }: Params)
{cover ? (
<Image
src={getPublicUrl(cover.storageKey)}
unoptimized
alt={recipe.title}
fill
sizes="(max-width: 640px) 50vw, (max-width: 768px) 33vw, 25vw"