fix: view-clinic demo 데이터 최우선 처리 — location.state 오염 방지
id === 'view-clinic' 체크를 useEffect 최상단으로 이동. 기존에는 location.state에 이전 분석 데이터가 남아있으면 transformApiReport를 통해 엉뚱한 병원 데이터가 렌더링되는 버그 수정. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>claude/bold-hawking
parent
0d209ef953
commit
4633560140
|
|
@ -38,6 +38,15 @@ export function useReport(id: string | undefined): UseReportResult {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
|
||||||
useEffect(() => {
|
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;
|
const state = location.state as LocationState | undefined;
|
||||||
|
|
||||||
// Source 1: Report data passed via navigation state (from AnalysisLoadingPage)
|
// Source 1: Report data passed via navigation state (from AnalysisLoadingPage)
|
||||||
|
|
@ -68,16 +77,7 @@ export function useReport(id: string | undefined): UseReportResult {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Source 2: Demo mode — return hardcoded mock data for sales prototype
|
// Source 2: Fetch from Supabase by report ID (bookmarked/shared link)
|
||||||
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)
|
|
||||||
if (id) {
|
if (id) {
|
||||||
fetchReportById(id)
|
fetchReportById(id)
|
||||||
.then((row) => {
|
.then((row) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue