From 31581e963f48a6a1acabff210a185b40f0477831 Mon Sep 17 00:00:00 2001 From: ValdiANS Date: Wed, 28 Jan 2026 09:39:32 +0700 Subject: [PATCH 1/2] fix: set empty daily checklist phase if phase is not selected --- .../daily-checklist/DailyChecklistContent.tsx | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/figma-make/components/pages/daily-checklist/DailyChecklistContent.tsx b/src/figma-make/components/pages/daily-checklist/DailyChecklistContent.tsx index 43a913ed..36a442b0 100644 --- a/src/figma-make/components/pages/daily-checklist/DailyChecklistContent.tsx +++ b/src/figma-make/components/pages/daily-checklist/DailyChecklistContent.tsx @@ -486,21 +486,19 @@ export function DailyChecklistContent() { try { // Insert new phase links - if (tempSelectedPhaseIds.length > 0) { - const setDailyChecklistPhaseRes = - await DailyChecklistApi.setDailyChecklistPhase( - dailyChecklistId, - tempSelectedPhaseIds - ); + const setDailyChecklistPhaseRes = + await DailyChecklistApi.setDailyChecklistPhase( + dailyChecklistId, + tempSelectedPhaseIds + ); - if (isResponseError(setDailyChecklistPhaseRes)) { - console.error( - 'Error saving phases:', - setDailyChecklistPhaseRes.message - ); - toast.error('Gagal menyimpan fase'); - return; - } + if (isResponseError(setDailyChecklistPhaseRes)) { + console.error( + 'Error saving phases:', + setDailyChecklistPhaseRes.message + ); + toast.error('Gagal menyimpan fase'); + return; } setSelectedPhaseIds([...tempSelectedPhaseIds]); From f87736154a831f5f9969171c0ff8b98f4d4bc9b6 Mon Sep 17 00:00:00 2001 From: ValdiANS Date: Wed, 28 Jan 2026 10:29:15 +0700 Subject: [PATCH 2/2] fix: only fetch initial value if the modal action is action for form --- .../transfer-to-laying/TransferToLayingFormModal.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/pages/production/transfer-to-laying/TransferToLayingFormModal.tsx b/src/components/pages/production/transfer-to-laying/TransferToLayingFormModal.tsx index 3ade0946..87541d8c 100644 --- a/src/components/pages/production/transfer-to-laying/TransferToLayingFormModal.tsx +++ b/src/components/pages/production/transfer-to-laying/TransferToLayingFormModal.tsx @@ -49,6 +49,8 @@ const TransferToLayingFormModal = () => { const modalAction = searchParams.get('action'); const transferToLayingId = searchParams.get('id'); + const isModalActionForForm = modalAction === 'add' || modalAction === 'edit'; + const { mutate } = useSWRConfig(); const refreshTransferToLayings = () => { @@ -60,7 +62,7 @@ const TransferToLayingFormModal = () => { const { data: transferToLaying, isLoading: isLoadingTransferToLaying } = useSWR( - transferToLayingId + isModalActionForForm && transferToLayingId ? ['detail-transfer-to-laying', transferToLayingId] : undefined, ([, id]) => TransferToLayingApi.getSingle(Number(id))