From 8b8c65dd1efc9c155e048f30a51ab905e57d79d6 Mon Sep 17 00:00:00 2001 From: nico Date: Thu, 5 Mar 2026 16:26:34 +0800 Subject: [PATCH] fix(apbdes-edit): clear imageId/fileId when user removes preview Problem: - Saat user klik X button untuk hapus preview image/file - Form state masih menyimpan imageId/fileId lama - Saat submit, data lama tetap terkirim - User tidak bisa benar-benar menghapus image/file Solution: - Clear apbdesState.edit.form.imageId saat hapus preview gambar - Clear apbdesState.edit.form.fileId saat hapus preview dokumen - Now user can truly make image/file empty Files changed: - src/app/admin/(dashboard)/landing-page/apbdes/[id]/edit/page.tsx Co-authored-by: Qwen-Coder --- .../admin/(dashboard)/landing-page/apbdes/[id]/edit/page.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/app/admin/(dashboard)/landing-page/apbdes/[id]/edit/page.tsx b/src/app/admin/(dashboard)/landing-page/apbdes/[id]/edit/page.tsx index 90599e93..59d7006c 100644 --- a/src/app/admin/(dashboard)/landing-page/apbdes/[id]/edit/page.tsx +++ b/src/app/admin/(dashboard)/landing-page/apbdes/[id]/edit/page.tsx @@ -377,6 +377,7 @@ function EditAPBDes() { onClick={() => { setPreviewImage(null); setImageFile(null); + apbdesState.edit.form.imageId = ''; // Clear imageId from form }} > @@ -436,6 +437,7 @@ function EditAPBDes() { onClick={() => { setPreviewDoc(null); setDocFile(null); + apbdesState.edit.form.fileId = ''; // Clear fileId from form }} >