feat(WEB): 자재/출고/생산/품질/단가 기능 대폭 개선 및 신규 페이지 추가
자재관리: - 입고관리 재고조정 다이얼로그 신규 추가, 상세/목록 기능 확장 - 재고현황 컴포넌트 리팩토링 출고관리: - 출하관리 생성/수정/목록/상세 개선 - 차량배차관리 상세/수정/목록 기능 보강 생산관리: - 작업지시서 WIP 생산 모달 신규 추가 - 벤딩WIP/슬랫조인트바 검사 콘텐츠 신규 추가 - 작업자화면 기능 대폭 확장 (카드/목록 개선) - 검사성적서 모달 개선 품질관리: - 실적보고서 관리 페이지 신규 추가 - 검사관리 문서/타입/목데이터 개선 단가관리: - 단가배포 페이지 및 컴포넌트 신규 추가 - 단가표 관리 페이지 및 컴포넌트 신규 추가 공통: - 권한 시스템 추가 개선 (PermissionContext, usePermission, PermissionGuard) - 메뉴 폴링 훅 개선, 레이아웃 수정 - 모바일 줌/패닝 CSS 수정 - locale 유틸 추가 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -106,6 +106,19 @@ export function useMenuPolling(options: UseMenuPollingOptions = {}): UseMenuPoll
|
||||
const sessionExpiredCountRef = useRef(0); // 연속 401 카운트
|
||||
const isSessionExpiredRef = useRef(false); // 세션 만료로 중지된 상태
|
||||
|
||||
// 콜백을 ref로 저장하여 인터벌 리셋 방지
|
||||
// (인라인 콜백이 매 렌더마다 새 참조를 생성해도 인터벌에 영향 없음)
|
||||
const onMenuUpdatedRef = useRef(onMenuUpdated);
|
||||
const onErrorRef = useRef(onError);
|
||||
const onSessionExpiredRef = useRef(onSessionExpired);
|
||||
|
||||
// 콜백 ref를 최신 값으로 동기화
|
||||
useEffect(() => {
|
||||
onMenuUpdatedRef.current = onMenuUpdated;
|
||||
onErrorRef.current = onError;
|
||||
onSessionExpiredRef.current = onSessionExpired;
|
||||
});
|
||||
|
||||
// 폴링 중지 (내부용)
|
||||
const stopPolling = useCallback(() => {
|
||||
if (intervalRef.current) {
|
||||
@@ -114,7 +127,7 @@ export function useMenuPolling(options: UseMenuPollingOptions = {}): UseMenuPoll
|
||||
}
|
||||
}, []);
|
||||
|
||||
// 메뉴 갱신 실행
|
||||
// 메뉴 갱신 실행 (의존성: stopPolling만 — 안정적)
|
||||
const executeRefresh = useCallback(async () => {
|
||||
if (isPausedRef.current || isSessionExpiredRef.current) return;
|
||||
|
||||
@@ -125,7 +138,7 @@ export function useMenuPolling(options: UseMenuPollingOptions = {}): UseMenuPoll
|
||||
sessionExpiredCountRef.current = 0;
|
||||
|
||||
if (result.updated) {
|
||||
onMenuUpdated?.();
|
||||
onMenuUpdatedRef.current?.();
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -140,16 +153,16 @@ export function useMenuPolling(options: UseMenuPollingOptions = {}): UseMenuPoll
|
||||
console.log('[Menu] 세션 만료로 폴링 중지');
|
||||
isSessionExpiredRef.current = true;
|
||||
stopPolling();
|
||||
onSessionExpired?.();
|
||||
onSessionExpiredRef.current?.();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 기타 에러 (네트워크 등) → 401 카운트 리셋하지 않음
|
||||
if (result.error) {
|
||||
onError?.(result.error);
|
||||
onErrorRef.current?.(result.error);
|
||||
}
|
||||
}, [onMenuUpdated, onError, onSessionExpired, stopPolling]);
|
||||
}, [stopPolling]);
|
||||
|
||||
// 수동 갱신 함수
|
||||
const refresh = useCallback(async () => {
|
||||
|
||||
Reference in New Issue
Block a user