From 4633560140f627e6847ed735f4df5667c2ebd380 Mon Sep 17 00:00:00 2001 From: Haewon Kam Date: Mon, 13 Apr 2026 13:51:12 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20view-clinic=20demo=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EC=B5=9C=EC=9A=B0=EC=84=A0=20=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?=E2=80=94=20location.state=20=EC=98=A4=EC=97=BC=20=EB=B0=A9?= =?UTF-8?q?=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit id === 'view-clinic' 체크를 useEffect 최상단으로 이동. 기존에는 location.state에 이전 분석 데이터가 남아있으면 transformApiReport를 통해 엉뚱한 병원 데이터가 렌더링되는 버그 수정. Co-Authored-By: Claude Sonnet 4.6 --- src/hooks/useReport.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/hooks/useReport.ts b/src/hooks/useReport.ts index f4aaef7..0ab16b9 100644 --- a/src/hooks/useReport.ts +++ b/src/hooks/useReport.ts @@ -38,6 +38,15 @@ export function useReport(id: string | undefined): UseReportResult { const location = useLocation(); useEffect(() => { + // Source 0: Demo mode — ALWAYS takes priority over any other source + if (id === 'view-clinic') { + setData(mockReport); + setIsEnriched(true); + setSocialHandles({ instagram: '@viewplastic', youtube: '@ViewclinicKR', facebook: 'viewps1' }); + setIsLoading(false); + return; + } + const state = location.state as LocationState | undefined; // Source 1: Report data passed via navigation state (from AnalysisLoadingPage) @@ -68,16 +77,7 @@ export function useReport(id: string | undefined): UseReportResult { return; } - // Source 2: Demo mode — return hardcoded mock data for sales prototype - if (id === 'view-clinic') { - setData(mockReport); - setIsEnriched(true); - setSocialHandles({ instagram: '@viewplastic', youtube: '@ViewclinicKR', facebook: 'viewps1' }); - setIsLoading(false); - return; - } - - // Source 3: Fetch from Supabase by report ID (bookmarked/shared link) + // Source 2: Fetch from Supabase by report ID (bookmarked/shared link) if (id) { fetchReportById(id) .then((row) => {