탭 컴포넌트 외부 검색필터 동작 구현
This commit is contained in:
@@ -59,6 +59,9 @@ export function useEntityJoinOptimization(columnMeta: Record<string, ColumnMetaI
|
||||
|
||||
// 변환된 값 캐시 (중복 변환 방지)
|
||||
const convertedCache = useRef(new Map<string, string>());
|
||||
|
||||
// 초기화 완료 플래그 (무한 루프 방지)
|
||||
const initialLoadDone = useRef(false);
|
||||
|
||||
// 공통 코드 카테고리 추출 (메모이제이션)
|
||||
const codeCategories = useMemo(() => {
|
||||
@@ -293,24 +296,40 @@ export function useEntityJoinOptimization(columnMeta: Record<string, ColumnMetaI
|
||||
[codeCategories, batchLoadCodes, updateMetrics],
|
||||
);
|
||||
|
||||
// 초기화 시 공통 코드 프리로딩
|
||||
// 초기화 시 공통 코드 프리로딩 (한 번만 실행)
|
||||
useEffect(() => {
|
||||
// 이미 초기화되었으면 스킵 (무한 루프 방지)
|
||||
if (initialLoadDone.current) return;
|
||||
initialLoadDone.current = true;
|
||||
|
||||
preloadCommonCodesOnMount();
|
||||
}, [preloadCommonCodesOnMount]);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
// 컬럼 메타 변경 시 필요한 코드 추가 로딩
|
||||
// 이미 로딩 중이면 스킵하여 무한 루프 방지
|
||||
const loadedCategoriesRef = useRef<Set<string>>(new Set());
|
||||
|
||||
useEffect(() => {
|
||||
// 이미 최적화 중이거나 초기화 전이면 스킵
|
||||
if (isOptimizing) return;
|
||||
|
||||
if (codeCategories.length > 0) {
|
||||
const unloadedCategories = codeCategories.filter((category) => {
|
||||
// 이미 로드 요청을 보낸 카테고리는 스킵
|
||||
if (loadedCategoriesRef.current.has(category)) return false;
|
||||
return codeCache.getCodeSync(category) === null;
|
||||
});
|
||||
|
||||
if (unloadedCategories.length > 0) {
|
||||
// 로딩 요청 카테고리 기록
|
||||
unloadedCategories.forEach(cat => loadedCategoriesRef.current.add(cat));
|
||||
console.log(`🔄 새로운 코드 카테고리 감지, 추가 로딩: ${unloadedCategories.join(", ")}`);
|
||||
batchLoadCodes(unloadedCategories);
|
||||
}
|
||||
}
|
||||
}, [codeCategories, batchLoadCodes]);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [codeCategories.join(",")]); // 배열 내용 기반 의존성
|
||||
|
||||
// 주기적으로 메트릭 업데이트
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user