refactor(WEB): 코드 품질 개선 및 불필요 코드 제거
- 미사용 import/변수/console.log 대량 정리 (100+개 파일) - ItemMasterContext 간소화 (미사용 로직 제거) - IntegratedListTemplateV2 / UniversalListPage 개선 - 결재 컴포넌트(ApprovalBox, DraftBox, ReferenceBox) 정리 - HR 컴포넌트(급여/휴가/부서) 코드 간소화 - globals.css 스타일 정리 및 개선 - AuthenticatedLayout 개선 - middleware CSP 정리 - proxy route 불필요 로깅 제거 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -183,26 +183,22 @@ export const useMasterDataStore = create<MasterDataStore>()(
|
||||
|
||||
// 🔒 이미 로딩 중이면 중복 요청 방지
|
||||
if (loading[pageType]) {
|
||||
console.log(`⏳ [Already Loading] ${pageType}`);
|
||||
return pageConfigs[pageType] || null;
|
||||
}
|
||||
|
||||
// 🔒 최근에 에러가 발생했으면 재시도 방지 (캐시 무효화 전까지)
|
||||
if (errors[pageType] && pageConfigs[pageType] === null) {
|
||||
console.log(`🚫 [Skip - Previous Error] ${pageType}: ${errors[pageType]}`);
|
||||
return null;
|
||||
}
|
||||
|
||||
// 1️⃣ 메모리 캐시 확인 (Zustand)
|
||||
if (pageConfigs[pageType]) {
|
||||
console.log(`✅ [Cache Hit - Memory] ${pageType}`);
|
||||
return pageConfigs[pageType];
|
||||
}
|
||||
|
||||
// 2️⃣ sessionStorage 확인
|
||||
const cachedConfig = getConfigFromSessionStorage(currentTenantId, pageType);
|
||||
if (cachedConfig) {
|
||||
console.log(`✅ [Cache Hit - Session] ${pageType}`);
|
||||
|
||||
// 메모리에 저장
|
||||
set(
|
||||
@@ -220,7 +216,6 @@ export const useMasterDataStore = create<MasterDataStore>()(
|
||||
}
|
||||
|
||||
// 3️⃣ API 요청 (Redis/Database)
|
||||
console.log(`🌐 [API Request] ${pageType}`);
|
||||
|
||||
try {
|
||||
get().setLoading(pageType, true);
|
||||
@@ -261,7 +256,6 @@ export const useMasterDataStore = create<MasterDataStore>()(
|
||||
|
||||
setConfigToSessionStorage(currentTenantId, pageType, config);
|
||||
|
||||
console.log(`✅ [Config Loaded] ${pageType}`, config);
|
||||
return config;
|
||||
} catch (error) {
|
||||
const errorMessage = error instanceof Error ? error.message : '페이지 구성 조회 실패';
|
||||
@@ -302,7 +296,6 @@ export const useMasterDataStore = create<MasterDataStore>()(
|
||||
|
||||
removeConfigFromSessionStorage(currentTenantId, pageType);
|
||||
|
||||
console.log(`🗑️ [Cache Invalidated] ${pageType}`);
|
||||
},
|
||||
|
||||
invalidateAllConfigs: () => {
|
||||
@@ -324,7 +317,6 @@ export const useMasterDataStore = create<MasterDataStore>()(
|
||||
console.error('[Cache Invalidation Error]:', error);
|
||||
});
|
||||
|
||||
console.log('🗑️ [All Caches Invalidated]');
|
||||
},
|
||||
|
||||
// ===== 페이지 타입 선택 =====
|
||||
@@ -404,7 +396,6 @@ export const useMasterDataStore = create<MasterDataStore>()(
|
||||
window.sessionStorage.removeItem(key);
|
||||
}
|
||||
});
|
||||
console.log('[masterDataStore] Reset: cleared memory and sessionStorage cache');
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user