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 <noreply@anthropic.com>
This commit is contained in:
Andymick
2026-07-18 18:56:41 +01:00
co-authored by Claude Haiku 4.5
parent f64462c5fe
commit 63ae432793
+16
View File
@@ -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();