[as fr] 상세뷰에서 무한 반복 호출해서 원복함 PbadmsDetailGate는 isPending === true일 때 children(상세 뷰 컴포넌트)을 렌더링하지 않고 <DetailSkeleton />으로 교체(자식 언마운트)합니다.

최초 조회가 끝나서 isFetching: false가 되면 자식인 FnrsViewPage가 마운트됩니다.
                              그런데 자식인 FnrsViewPage 내부에서도 useFnrsCnsltnMng(id)를 호출하는데, 이 쿼리는 refetchOnMount: "always"로 설정되어 있어 컴포넌트가 마운트될 때마다 백그라운드 재조회를 트리거합니다.
                              백그라운드 재조회가 시작되는 순간 같은 쿼리키를 공유하는 부모 DetailGate의 isFetching이 다시 true가 됩니다.
                              isFetching === true가 되었으므로 PbadmsDetailGate가 즉시 FnrsViewPage를 언마운트하고 스켈레톤을 띄웁니다.
                              재조회가 완료되면 isFetching === false가 되어 다시 FnrsViewPage를 마운트합니다.
                              마운트되면서 refetchOnMount: "always"로 인해 다시 재조회 트리거 → 언마운트 → 마운트 → 무한 루프가 발생하여 Network 탭에 초당 수십 건 이상의 요청이 끊임없이 발생했던 것입니다.
This commit is contained in:
2026-10-27 18:01:41 +09:00
parent 4e9a4efa2a
commit 8b34a5d7a9
3 changed files with 6 additions and 6 deletions
@@ -12,7 +12,7 @@ interface FnrsDetailGateProps {
function FnrsDetailGate({ id }: FnrsDetailGateProps) {
const userInfo = useUserStore((state) => state.userInfo);
const { data, isLoading, isFetching, isError } = useFnrsCnsltnMng(id);
const { data, isLoading, isError } = useFnrsCnsltnMng(id);
const canEdit = canEditPbadmsDoc({
docSeComCd: "FNRS",
prgrsSttsComCd: data?.detDto?.prgrsSttsComCd,
@@ -22,7 +22,7 @@ function FnrsDetailGate({ id }: FnrsDetailGateProps) {
return (
<PbadmsDetailGate
isPending={!userInfo || isLoading || isFetching}
isPending={!userInfo || isLoading}
isError={isError}
shouldRedirectToEdit={Boolean(userInfo) && canEdit}
editHref={`/fnrs-cnsltn/${id}/edit`}
@@ -12,7 +12,7 @@ interface InstlSncnDetailGateProps {
function InstlSncnDetailGate({ id }: InstlSncnDetailGateProps) {
const userInfo = useUserStore((state) => state.userInfo);
const { data, isLoading, isFetching, isError } = useInstlSncnDetail(id);
const { data, isLoading, isError } = useInstlSncnDetail(id);
const shouldRedirectToEdit = canEditPbadmsDoc({
docSeComCd: "INSTL",
prgrsSttsComCd: data?.detDto.prgrsSttsComCd,
@@ -22,7 +22,7 @@ function InstlSncnDetailGate({ id }: InstlSncnDetailGateProps) {
return (
<PbadmsDetailGate
isPending={!userInfo || isLoading || isFetching}
isPending={!userInfo || isLoading}
isError={isError}
shouldRedirectToEdit={Boolean(userInfo) && shouldRedirectToEdit}
editHref={`/instl-sncn/${id}/edit`}
@@ -13,7 +13,7 @@ interface SewerBscPlanDetailGateProps {
function SewerBscPlanDetailGate({ id, propChgCycl }: SewerBscPlanDetailGateProps) {
const userInfo = useUserStore((state) => state.userInfo);
const { data, isLoading, isFetching, isError } = useSewerBscPlan(id);
const { data, isLoading, isError } = useSewerBscPlan(id);
const shouldRedirectToEdit = canEditPbadmsDoc({
docSeComCd: "SEWER",
prgrsSttsComCd: data?.detDto?.prgrsSttsComCd,
@@ -24,7 +24,7 @@ function SewerBscPlanDetailGate({ id, propChgCycl }: SewerBscPlanDetailGateProps
return (
<PbadmsDetailGate
isPending={!userInfo || isLoading || isFetching}
isPending={!userInfo || isLoading}
isError={isError}
shouldRedirectToEdit={Boolean(userInfo) && shouldRedirectToEdit}
editHref={`/sewer-bsc-plan/${id}/edit?chgCycl=${chgCycl}`}