diff --git a/apps/sn/app/(map-layout)/map/components/agedPipe/AgedPipePopupPage.tsx b/apps/sn/app/(map-layout)/map/components/agedPipe/AgedPipePopupPage.tsx index 7fe989125..abeec2245 100644 --- a/apps/sn/app/(map-layout)/map/components/agedPipe/AgedPipePopupPage.tsx +++ b/apps/sn/app/(map-layout)/map/components/agedPipe/AgedPipePopupPage.tsx @@ -18,11 +18,13 @@ import { AGED_PIPE_LIST_HEADLIST, AGED_PIPE_PAGE_SIZE, buildAgedPipeCqlFilters, + getAgedPipeManagementName, normalizeAgedPipeFilters, toDisplayPipeRow, validateElapsedYears, type AgedPipeFilters, type AgedPipeRow, + type AgedPipeManagementAgency, } from "./agedPipeUtils"; import { downloadAgedPipeExcel } from "./agedPipeExport"; import MapPopupDataTable from "@/features/windowPopup/ui/MapPopupDataTable"; @@ -53,6 +55,15 @@ export default function AgedPipePopupPage() { const [appliedFilters, setAppliedFilters] = useState(initialFilters); const [rows, setRows] = useState([]); + // 관리기관명 조회가 늦게 완료되어도 기존 목록을 재조회하지 않고 표시만 갱신한다. + const [managementAgencies, setManagementAgencies] = useState([]); + const displayRows = useMemo( + () => rows.map((row) => ({ + ...row, + mngInstNm: getAgedPipeManagementName(row, managementAgencies), + })), + [rows, managementAgencies], + ); const [total, setTotal] = useState(0); const [currentPage, setCurrentPage] = useState(1); const [isLoading, setIsLoading] = useState(false); @@ -73,6 +84,19 @@ export default function AgedPipePopupPage() { if (sgg.length === 0) fetchSgg(); }, [ctpv.length, fetchCtpv, fetchSgg, sgg.length]); + useEffect(() => { + let active = true; + // 기존 GIS 관리 화면과 같은 기관 목록을 사용하고, 실패 시 관로 조회는 유지한다. + getData("v1/fcltPpl/mngInsts") + .then((response) => { + if (active) setManagementAgencies(Array.isArray(response) ? response : []); + }) + .catch(() => { + if (active) alert("관리기관명을 불러오지 못해 관리기관 코드로 표시합니다."); + }); + return () => { active = false; }; + }, [alert]); + const fetchRows = useCallback( async (page: number, nextFilters: AgedPipeFilters, size: number) => { const normalized = normalizeAgedPipeFilters(nextFilters); @@ -247,31 +271,6 @@ export default function AgedPipePopupPage() { ) : null} - - + +