From 1da2ae59f7382a65cc2af731d26321f489d1ba63 Mon Sep 17 00:00:00 2001 From: swcho Date: Wed, 13 Aug 2025 14:57:56 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=84=A4=EA=B3=84=EB=B9=88=EB=8F=84=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=EB=A9=94=EC=84=B8=EC=A7=80=20=EC=83=81?= =?UTF-8?q?=ED=83=9C=20=EC=B4=88=EA=B8=B0=ED=99=94=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/components/ui/verticalTable.tsx | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/apps/sn/app/components/ui/verticalTable.tsx b/apps/sn/app/components/ui/verticalTable.tsx index dc024e068..14c61bec8 100644 --- a/apps/sn/app/components/ui/verticalTable.tsx +++ b/apps/sn/app/components/ui/verticalTable.tsx @@ -67,15 +67,7 @@ export function VerticalTable({ }: UiTableProps) { const [cur, setCur] = useState(1); const [formData, setFormData] = useState<{ [key: string]: string | number | boolean }>({}); - const [errors, setErrors] = useState<{ [key: string]: string }>({}); // 에러 상태 추가 - - // 컴포넌트 언마운트 시 confirmToast 정리 - useEffect(() => { - return () => { - // 컴포넌트가 언마운트될 때 global-confirm-toast ID를 가진 Toast 제거 - toast.dismiss("global-confirm-toast"); - }; - }, []); + const [errors, setErrors] = useState<{ [key: string]: string }>({}); useEffect(() => { if (resetPageNo) { @@ -86,23 +78,19 @@ export function VerticalTable({ useEffect(() => { if (tableData.length > 0 && tableData[0]) { - // 깊은 복사를 통해 새로운 객체 생성 const newData = JSON.parse(JSON.stringify(tableData[0])); setFormData(newData); - console.log("Form data initialized:", newData); // 디버깅용 + setErrors({}); } }, [tableData]); const handleInputChange = (id: string, value: string | number | boolean) => { - console.log(`Input change: ${id} = ${value}`); // 디버깅용 const newFormData = { ...formData, [id]: value, }; - console.log("New form data:", newFormData); // 디버깅용 setFormData(newFormData); - // 에러 메시지 초기화 (입력이 성공하면 에러 제거) if (errors[id]) { setErrors(prev => { const newErrors = { ...prev }; @@ -111,7 +99,6 @@ export function VerticalTable({ }); } - // 폼 데이터가 변경될 때마다 부모에게 알림 if (onFormDataChange) { onFormDataChange(newFormData); }