From 0d9aef5003f2e79ba57324c98ed969ffb0bd7242 Mon Sep 17 00:00:00 2001 From: Andymick Date: Sat, 18 Jul 2026 21:05:36 +0100 Subject: [PATCH] Fix: Pass photo request ID instead of data URL Changed approach to pass customRequestId query parameter instead of the full data URL. The design canvas page now fetches the photo from the database using the request ID, avoiding URL length issues and making the URL cleaner. --- .claude/settings.local.json | 3 ++- src/app/admin/custom-requests/[id]/page.tsx | 2 +- src/app/made-to-order/[slug]/page.tsx | 15 +++++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.claude/settings.local.json b/.claude/settings.local.json index d817368..2e39691 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -81,7 +81,8 @@ "Bash(git commit -m 'Fix: Refresh page after updating order tracking details *)", "Bash(git commit -m 'Fix: Remove function prop from client component *)", "Bash(git commit -m 'Fix: Import revalidatePath from correct module *)", - "Bash(git commit -m 'Fix: Route photo requests to design canvas instead of approval upload *)" + "Bash(git commit -m 'Fix: Route photo requests to design canvas instead of approval upload *)", + "Bash(git commit -m 'Fix: Pass photo request ID instead of data URL *)" ] } } diff --git a/src/app/admin/custom-requests/[id]/page.tsx b/src/app/admin/custom-requests/[id]/page.tsx index 006e523..8a66d7e 100644 --- a/src/app/admin/custom-requests/[id]/page.tsx +++ b/src/app/admin/custom-requests/[id]/page.tsx @@ -19,7 +19,7 @@ export default async function CustomRequestDetailPage({ params }: { params: { id const whatsappMessage = `Hi ${request.customerName}, thanks for sending over your photo for a ${request.product.name} — we're working on it!`; const designParams = new URLSearchParams({ - customPhoto: request.imageDataUrl, + customRequestId: request.id, }); return ( diff --git a/src/app/made-to-order/[slug]/page.tsx b/src/app/made-to-order/[slug]/page.tsx index 2c479ee..a4e377e 100644 --- a/src/app/made-to-order/[slug]/page.tsx +++ b/src/app/made-to-order/[slug]/page.tsx @@ -12,7 +12,7 @@ export default async function ProductDetailPage({ searchParams, }: { params: { slug: string }; - searchParams: { customPhoto?: string }; + searchParams: { customRequestId?: string }; }) { const activePromotions = await fetchActivePromotions(); @@ -27,9 +27,20 @@ export default async function ProductDetailPage({ }); const related = relatedRows.map((p) => toProductDTO(p, activePromotions)); + // Fetch custom photo from request if customRequestId is provided + let customPhoto: string | undefined; + if (searchParams.customRequestId) { + const customRequest = await prisma.customRequest.findUnique({ + where: { id: searchParams.customRequestId }, + }); + if (customRequest) { + customPhoto = customRequest.imageDataUrl; + } + } + return (
- + {related.length > 0 && (