Use existing loading state for sparse detail

This commit is contained in:
2569718930@qq.com
2026-04-18 14:40:29 +08:00
parent 16033033a7
commit fe6477b09c
18 changed files with 308 additions and 90 deletions
@@ -190,12 +190,12 @@ export function DetailPanel() {
const heroSettlementLabel =
detail?.current?.settlement_source_label || basicSettlementLabel;
const heroAirportLabel = detail?.risk?.airport || basicAirportLabel;
const isDetailCompleting = Boolean(
const isSparsePanelDetail = Boolean(
detail &&
(detail.detail_depth !== "full" ||
(detail.forecast?.daily?.length ?? 0) <= 1),
);
const isPanelSyncing = store.loadingState.cityDetail || isDetailCompleting;
const isPanelSyncing = store.loadingState.cityDetail;
const blurActiveElement = () => {
if (typeof document === "undefined") return;
@@ -320,10 +320,10 @@ export function DetailPanel() {
<span className="panel-loading-spinner" aria-hidden="true" />
<span>
{locale === "en-US"
? isDetailCompleting
? isSparsePanelDetail
? `Completing ${panelDisplayName} cards...`
: `Syncing ${panelDisplayName}...`
: isDetailCompleting
: isSparsePanelDetail
? `正在补齐 ${panelDisplayName} 卡片...`
: `正在同步 ${panelDisplayName}...`}
</span>
@@ -999,9 +999,8 @@ export function ForecastTable() {
const daily = data.forecast?.daily || [];
const isSparseDaily = daily.length <= 1;
const isForecastCompleting =
store.loadingState.cityDetail ||
data.detail_depth !== "full" ||
isSparseDaily;
store.loadingState.cityDetail &&
(data.detail_depth !== "full" || isSparseDaily);
const resolveForecastTemp = (date: string, fallback: number | null | undefined) => {
const debPrediction = data.multi_model_daily?.[date]?.deb?.prediction;
return debPrediction ?? fallback ?? null;