fix: 진행 페이지 리로드 시 무한 로딩 + 동시 검사 수 상한 수정
- 리로드 시 API에서 현재 상태를 조회하여 스토어 복원 (initFromApi) - SITE_CONCURRENCY 서버 상한 4→8로 변경 (사용자 설정 8이 제대로 동작) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@ -24,7 +24,7 @@ class Settings(BaseSettings):
|
||||
# Site inspection
|
||||
SITE_MAX_PAGES: int = 500
|
||||
SITE_MAX_DEPTH: int = 2
|
||||
SITE_CONCURRENCY: int = 4
|
||||
SITE_CONCURRENCY: int = 8
|
||||
|
||||
# Application
|
||||
PROJECT_NAME: str = "Web Inspector API"
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { useSiteInspectionStore } from "@/stores/useSiteInspectionStore";
|
||||
import { useSiteInspectionSSE } from "@/hooks/useSiteInspectionSSE";
|
||||
import { useSiteInspectionResult } from "@/lib/queries";
|
||||
import { Progress } from "@/components/ui/progress";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { ErrorState } from "@/components/common/ErrorState";
|
||||
@ -36,8 +38,18 @@ export function SiteCrawlProgress({
|
||||
discoveredPages,
|
||||
aggregateScores,
|
||||
errorMessage,
|
||||
initFromApi,
|
||||
} = useSiteInspectionStore();
|
||||
|
||||
// API에서 현재 상태 조회 (리로드 시 스토어 복원용)
|
||||
const { data: apiResult } = useSiteInspectionResult(siteInspectionId);
|
||||
|
||||
useEffect(() => {
|
||||
if (apiResult && status === "idle") {
|
||||
initFromApi(apiResult);
|
||||
}
|
||||
}, [apiResult, status, initFromApi]);
|
||||
|
||||
// SSE 연결
|
||||
useSiteInspectionSSE(siteInspectionId);
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ import type {
|
||||
DiscoveredPage,
|
||||
AggregateScores,
|
||||
SiteInspectionPhase,
|
||||
SiteInspectionResult,
|
||||
CrawlProgress,
|
||||
SSECrawlComplete,
|
||||
SSEPageComplete,
|
||||
@ -21,6 +22,7 @@ interface SiteInspectionState {
|
||||
|
||||
// Actions
|
||||
setSiteInspection: (id: string, rootUrl: string) => void;
|
||||
initFromApi: (data: SiteInspectionResult) => void;
|
||||
setCrawlProgress: (pagesFound: number, currentUrl: string) => void;
|
||||
setCrawlComplete: (data: SSECrawlComplete) => void;
|
||||
updatePageStatus: (
|
||||
@ -63,6 +65,23 @@ export const useSiteInspectionStore = create<SiteInspectionState>(
|
||||
status: "crawling",
|
||||
}),
|
||||
|
||||
initFromApi: (data) =>
|
||||
set((state) => {
|
||||
// Only init if store is idle (prevents overwriting live SSE data)
|
||||
if (state.status !== "idle") return state;
|
||||
return {
|
||||
siteInspectionId: data.site_inspection_id,
|
||||
rootUrl: data.root_url,
|
||||
status: data.status as SiteInspectionPhase,
|
||||
discoveredPages: data.discovered_pages,
|
||||
aggregateScores: data.aggregate_scores,
|
||||
crawlProgress: {
|
||||
pagesFound: data.discovered_pages.length,
|
||||
currentUrl: "",
|
||||
},
|
||||
};
|
||||
}),
|
||||
|
||||
setCrawlProgress: (pagesFound, currentUrl) =>
|
||||
set({
|
||||
status: "crawling",
|
||||
|
||||
Reference in New Issue
Block a user