From f6c8610104cf2b1b34bf2202f7d8ff7956384849 Mon Sep 17 00:00:00 2001 From: kent Date: Thu, 15 Jan 2026 16:13:30 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EA=B2=AC=EC=A0=81=20=EC=84=A0=ED=83=9D?= =?UTF-8?q?=20=EB=8B=A4=EC=9D=B4=EC=96=BC=EB=A1=9C=EA=B7=B8=20=EA=B0=9C?= =?UTF-8?q?=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - actions.ts: for_order=true 파라미터 추가 (수주 전환된 견적 제외) - QuotationSelectDialog: 두 번 호출되는 문제 수정 - 두 개의 useEffect를 하나로 통합 - 초기 로드는 즉시, 검색은 디바운스 적용 --- src/components/orders/QuotationSelectDialog.tsx | 16 ++++++---------- src/components/orders/actions.ts | 2 ++ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/components/orders/QuotationSelectDialog.tsx b/src/components/orders/QuotationSelectDialog.tsx index 952e8c53..acb4c90c 100644 --- a/src/components/orders/QuotationSelectDialog.tsx +++ b/src/components/orders/QuotationSelectDialog.tsx @@ -74,21 +74,17 @@ export function QuotationSelectDialog({ } }, []); - // 다이얼로그 열릴 때 데이터 로드 - useEffect(() => { - if (open) { - setSearchTerm(""); - fetchQuotations(); - } - }, [open, fetchQuotations]); - - // 검색어 변경 시 디바운스 적용하여 API 호출 + // 다이얼로그 열릴 때 데이터 로드 + 검색어 변경 시 디바운스 적용 useEffect(() => { if (!open) return; + // 검색어가 빈 문자열이면 즉시 호출 (다이얼로그 열림 시) + // 검색어가 있으면 디바운스 적용 + const delay = searchTerm === "" ? 0 : 300; + const timer = setTimeout(() => { fetchQuotations(searchTerm || undefined); - }, 300); + }, delay); return () => clearTimeout(timer); }, [searchTerm, open, fetchQuotations]); diff --git a/src/components/orders/actions.ts b/src/components/orders/actions.ts index 8d60ee8b..0b215f4a 100644 --- a/src/components/orders/actions.ts +++ b/src/components/orders/actions.ts @@ -1043,6 +1043,8 @@ export async function getQuotesForSelect(params?: { searchParams.set('status', 'finalized'); // 품목 포함 (수주 전환용) searchParams.set('with_items', 'true'); + // 수주 전환용: 이미 수주가 생성된 견적 제외 (이중 체크) + searchParams.set('for_order', 'true'); if (params?.q) searchParams.set('q', params.q); if (params?.page) searchParams.set('page', String(params.page)); if (params?.size) searchParams.set('size', String(params.size || 50));