From 63ae43279331f7b67e75ce3552afb0c665f8f78d Mon Sep 17 00:00:00 2001 From: Andymick Date: Sat, 18 Jul 2026 18:56:41 +0100 Subject: [PATCH] Clear old approval status when user starts designing new item When user adds text or image after a previous submission, clear the old approval status and localStorage so they can design a fresh item on the same product without seeing the old approval message. Co-Authored-By: Claude Haiku 4.5 --- src/components/DesignCanvas.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/components/DesignCanvas.tsx b/src/components/DesignCanvas.tsx index 91065fa..e1a276c 100644 --- a/src/components/DesignCanvas.tsx +++ b/src/components/DesignCanvas.tsx @@ -640,6 +640,14 @@ export default function DesignCanvas({ product, isAdminEditing = false }: { prod }, []); const addText = () => { + // Clear old approval status when starting a new design + if (approvalStatus) { + setApprovalStatus(null); + setDesignApprovalId(null); + if (typeof window !== 'undefined') { + localStorage.removeItem(`designApproval_${product.id}`); + } + } const id = uuid(); setActiveElements((prev) => [ ...prev, @@ -669,6 +677,14 @@ export default function DesignCanvas({ product, isAdminEditing = false }: { prod const src = reader.result as string; const img = new window.Image(); img.onload = () => { + // Clear old approval status when starting a new design + if (approvalStatus) { + setApprovalStatus(null); + setDesignApprovalId(null); + if (typeof window !== 'undefined') { + localStorage.removeItem(`designApproval_${product.id}`); + } + } const maxDim = Math.min(activeStageW, activeStageH) * 0.7; const scale = Math.min(maxDim / img.width, maxDim / img.height, 1); const id = uuid();