diff --git a/apps/sn/src/features/windowPopup/ui/SearchModalPopupContent.tsx b/apps/sn/src/features/windowPopup/ui/SearchModalPopupContent.tsx index 0bbb50bbe..ed32a55a8 100644 --- a/apps/sn/src/features/windowPopup/ui/SearchModalPopupContent.tsx +++ b/apps/sn/src/features/windowPopup/ui/SearchModalPopupContent.tsx @@ -1,5 +1,48 @@ +"use client"; + import SearchModal from "@/app/(map-layout)/map/searchModal/searchModal"; +import useStore from "@/store/useStore"; +import { useEffect } from "react"; export default function SearchModalPopupContent() { + const { + ctpv, + sgg, + BIZ_SE_CD, + BIZ_TY_CD, + fetchCtpv, + fetchSgg, + fetchBIZ_SE_CD, + fetchBIZ_TY_CD, + } = useStore(); + + useEffect(() => { + // Popup windows do not run map-layout initialization, so load search codes here. + if (ctpv.length === 0) { + void fetchCtpv(); + } + + if (sgg.length === 0) { + void fetchSgg(); + } + + 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 ; }