From a9ed45a3d3ce31852975cf500e72919d25f39685 Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Tue, 16 Jun 2026 05:43:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=BE=E8=A1=A8=20referenc?= =?UTF-8?q?e-only=20=E5=8A=A0=E8=BD=BD=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scan-terminal/TemperatureChartCanvas.tsx | 24 +++++++++++++++++-- .../__tests__/terminalGridPolicy.test.ts | 4 ++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/frontend/components/dashboard/scan-terminal/TemperatureChartCanvas.tsx b/frontend/components/dashboard/scan-terminal/TemperatureChartCanvas.tsx index 4646ea4f..a6c254e2 100644 --- a/frontend/components/dashboard/scan-terminal/TemperatureChartCanvas.tsx +++ b/frontend/components/dashboard/scan-terminal/TemperatureChartCanvas.tsx @@ -50,6 +50,26 @@ function hasDrawableTemperatureChartContent({ ); } +function isFallbackReferenceSeries(series: EvidenceSeries) { + return series.key === "current" && series.label === "Current reference"; +} + +function hasDrawablePrimaryTemperatureChartContent({ + activeSeries, + probabilityOverlay, + zoomedData, +}: { + activeSeries: EvidenceSeries[]; + probabilityOverlay: ProbabilityOverlay | null; + zoomedData: Array>; +}) { + return hasDrawableTemperatureChartContent({ + activeSeries: activeSeries.filter((series) => !isFallbackReferenceSeries(series)), + probabilityOverlay, + zoomedData, + }); +} + function shouldKeepTemperatureChartLoading({ row, isHourlyLoading, @@ -65,7 +85,7 @@ function shouldKeepTemperatureChartLoading({ }) { if (!row?.city) return false; if (!isHourlyLoading) return false; - return !hasDrawableTemperatureChartContent({ activeSeries, probabilityOverlay, zoomedData }); + return !hasDrawablePrimaryTemperatureChartContent({ activeSeries, probabilityOverlay, zoomedData }); } function TemperatureChartSkeleton({ compact }: { compact: boolean }) { @@ -225,7 +245,7 @@ function TemperatureChartCanvasComponent({ }); const shouldRenderChart = canRenderChart && hasDrawableChartContent; const shouldShowEmptyState = Boolean(row?.city) && !isHourlyLoading && !hasDrawableChartContent; - const shouldShowBackgroundRefresh = isHourlyLoading && hasDrawableChartContent; + const shouldShowBackgroundRefresh = isHourlyLoading && hasDrawableChartContent && !shouldShowChartLoading; const shouldShowUnavailableState = Boolean(row?.city) && Boolean(detailError) && !isHourlyLoading && !hasDrawableChartContent; const shouldShowBackgroundError = showDetailErrorBadge && Boolean(row?.city) && !isHourlyLoading && hasDrawableChartContent && diff --git a/frontend/components/dashboard/scan-terminal/__tests__/terminalGridPolicy.test.ts b/frontend/components/dashboard/scan-terminal/__tests__/terminalGridPolicy.test.ts index 87b35d13..eb48829d 100644 --- a/frontend/components/dashboard/scan-terminal/__tests__/terminalGridPolicy.test.ts +++ b/frontend/components/dashboard/scan-terminal/__tests__/terminalGridPolicy.test.ts @@ -265,7 +265,7 @@ export function runTests() { "temperature chart should render once a visible series has drawable values", ); assert( - !__shouldKeepTemperatureChartLoadingForTest({ + __shouldKeepTemperatureChartLoadingForTest({ row: { city: "Moscow" } as any, isHourlyLoading: true, activeSeries: [ @@ -283,6 +283,6 @@ export function runTests() { { label: "05:00", ts: 2, current: 13 }, ], }), - "temperature chart must render seeded or cached data immediately while full detail continues loading in the background", + "temperature chart should keep the loading overlay when the only drawable series is the fallback Current reference line", ); }