From d4797617a66c94d73c826862e6f7caa569531672 Mon Sep 17 00:00:00 2001 From: kiminchan Date: Thu, 25 Jun 2026 10:40:28 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A0=95=EB=B3=B4=EA=B2=80=EC=83=89=20?= =?UTF-8?q?=ED=8C=9D=EC=97=85=20=EC=B4=88=EA=B8=B0=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EB=A1=9C=EB=94=A9=20=EB=B0=8F=20=EC=B5=9C=EC=B4=88=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EB=B3=B4=EC=99=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/searchModal/searchModal.tsx | 11 +++++- .../ui/SearchModalPopupContent.tsx | 35 +++++-------------- 2 files changed, 19 insertions(+), 27 deletions(-) diff --git a/apps/sn/app/(map-layout)/map/searchModal/searchModal.tsx b/apps/sn/app/(map-layout)/map/searchModal/searchModal.tsx index 82f9f7fe3..797969427 100644 --- a/apps/sn/app/(map-layout)/map/searchModal/searchModal.tsx +++ b/apps/sn/app/(map-layout)/map/searchModal/searchModal.tsx @@ -28,9 +28,10 @@ import { openWindowPopup } from '@/features/windowPopup/lib/openWindowPopup'; type SearchModalProps = { renderMode?: "launcher" | "popup"; + autoSearchReady?: boolean; }; -const SearchModal: React.FC = ({ renderMode = "launcher" }) => { +const SearchModal: React.FC = ({ renderMode = "launcher", autoSearchReady = false }) => { const { showTable, isSearchModalOpen, setIsSearchModalOpen, @@ -65,6 +66,7 @@ const SearchModal: React.FC = ({ renderMode = "launcher" }) => handleOperationPageNation } = useOperationTab(); const hasAutoOpenedReportRef = useRef(false); + const hasAutoSearchedRef = useRef(false); const dynamicHeadlist: { id: string, title: string }[] = useMemo(() => { @@ -133,6 +135,13 @@ const SearchModal: React.FC = ({ renderMode = "launcher" }) => resetFilters(); }, [activeTab, basicType, workType]); + useEffect(() => { + if (renderMode !== "popup" || !autoSearchReady || hasAutoSearchedRef.current) return; + + hasAutoSearchedRef.current = true; + void fetchFilteredData(); + }, [autoSearchReady, fetchFilteredData, renderMode]); + // 페이지 변경 시마다 데이터 fetch useEffect(() => { setIsResetPage(false); diff --git a/apps/sn/src/features/windowPopup/ui/SearchModalPopupContent.tsx b/apps/sn/src/features/windowPopup/ui/SearchModalPopupContent.tsx index ed32a55a8..34343b6d0 100644 --- a/apps/sn/src/features/windowPopup/ui/SearchModalPopupContent.tsx +++ b/apps/sn/src/features/windowPopup/ui/SearchModalPopupContent.tsx @@ -17,32 +17,15 @@ export default function SearchModalPopupContent() { } = useStore(); useEffect(() => { - // Popup windows do not run map-layout initialization, so load search codes here. - if (ctpv.length === 0) { - void fetchCtpv(); - } + // Popup windows do not run map-layout initialization, so load location codes here. + if (ctpv.length === 0) void fetchCtpv(); + if (sgg.length === 0) void fetchSgg(); + }, [ctpv.length, fetchCtpv, fetchSgg, sgg.length]); - if (sgg.length === 0) { - void fetchSgg(); - } + useEffect(() => { + if (BIZ_SE_CD.length === 0) void fetchBIZ_SE_CD(); + if (BIZ_TY_CD.length === 0) void fetchBIZ_TY_CD(); + }, [BIZ_SE_CD.length, BIZ_TY_CD.length, fetchBIZ_SE_CD, fetchBIZ_TY_CD]); - if (BIZ_SE_CD.length === 0) { - void fetchBIZ_SE_CD(); - } - - if (BIZ_TY_CD.length === 0) { - void fetchBIZ_TY_CD(); - } - }, [ - BIZ_SE_CD.length, - BIZ_TY_CD.length, - ctpv.length, - fetchBIZ_SE_CD, - fetchBIZ_TY_CD, - fetchCtpv, - fetchSgg, - sgg.length, - ]); - - return ; + return 0 && sgg.length > 0} />; }