Merge remote-tracking branch 'origin/main' into feature/negodata

This commit is contained in:
minaChoi committed 2026-06-26 14:30:29 +09:00
commit aed8364b40
12 files changed
+397 -44

No files matched your search

+13 -2
View File
@@ -6,6 +6,7 @@ import { useEffect } from 'react';
// 중첩 오버레이 대비 카운터로 관리 — 마지막 하나가 닫힐 때만 원복.
let lockCount = 0;
let prevOverflow = '';
let pendingRestore = 0; // requestAnimationFrame id (0 = 없음)
function scroller(): HTMLElement {
return (document.scrollingElement as HTMLElement | null) ?? document.documentElement;
@@ -14,7 +15,13 @@ function scroller(): HTMLElement {
export function useScrollLock(active = true) {
useEffect(() => {
if (!active) return;
if (lockCount === 0) {
if (pendingRestore !== 0) {
// 직전 해제로 예약된 복원이 남아 있으면 취소 — 언마운트→재마운트(라운드 전환 등) 사이의
// 일시적 0 을 흡수한다. 이때 overflow 는 아직 'hidden' 이고 prevOverflow 도 원래 값 그대로다.
cancelAnimationFrame(pendingRestore);
pendingRestore = 0;
} else if (lockCount === 0) {
// 진짜 첫 잠금일 때만 원래 overflow 를 보관하고 잠근다('hidden' 을 prevOverflow 로 캡처하는 사고 방지).
const el = scroller();
prevOverflow = el.style.overflow;
el.style.overflow = 'hidden';
@@ -23,7 +30,11 @@ export function useScrollLock(active = true) {
return () => {
lockCount -= 1;
if (lockCount === 0) {
scroller().style.overflow = prevOverflow;
// 마지막 해제는 다음 프레임으로 미룬다 — 곧바로 새 잠금이 들어오면(재마운트) 위에서 취소된다.
pendingRestore = requestAnimationFrame(() => {
pendingRestore = 0;
if (lockCount === 0) scroller().style.overflow = prevOverflow;
});
}
};
}, [active]);
+5 -1
View File
@@ -1,4 +1,5 @@
import { Settings, Plus } from 'lucide-react';
import { keepPreviousData } from '@tanstack/react-query';
import { useOverlayRouter } from '@/lib/useOverlayRouter';
import { PageContainer } from '@/components/layout/PageContainer';
import { PageToolbar, SearchInput } from '@/components/layout/PageToolbar';
@@ -51,8 +52,11 @@ export default function QuotationPage() {
// 상세 요약은 리스트에서 find 하지 않고 단건 API 로 받아온다(딥링크 시 리스트 의존 제거).
// 탭 복귀 시 재조회(자리비운 사이 스케줄러가 마감/낙찰/재생성했을 수 있음). 전역 기본은 false라 상세만 켠다.
// 라운드 전환(detailId 교체) 시 새 데이터 도착 전까지 이전 견적을 유지한다.
// 이렇게 해야 activeQuotation 이 잠시 null 로 떨어지지 않아 시트(key={qt_id})가 언마운트→재마운트되지 않고,
// 그 사이 useScrollLock 이 풀려 배경이 스크롤되는 현상도 사라진다. (목록 등 다른 쿼리와 동일한 패턴)
const detailQuery = useGetQuotation(detailId ?? '', {
query: { enabled: !!detailId, refetchOnWindowFocus: true },
query: { enabled: !!detailId, refetchOnWindowFocus: true, placeholderData: keepPreviousData },
});
const activeQuotation = detailQuery.data?.quotation ?? null;