Show stale detail blocker while refreshing city data

This commit is contained in:
2569718930@qq.com
2026-04-18 23:14:25 +08:00
parent 25122fed4a
commit f521cb537e
4 changed files with 54 additions and 7 deletions
+1 -5
View File
@@ -788,11 +788,7 @@ export function DashboardStoreProvider({
return;
}
const cachedDetail = cityDetailsByName[cityName];
const needsDetailRefresh = hasSparseDetailCoverage(
cachedDetail,
cachedDetail?.local_date,
);
const needsDetailRefresh = true;
setLoadingState((current) => ({ ...current, cityDetail: true }));
const detailPromise = ensureCityDetail(cityName, needsDetailRefresh, "panel");
void Promise.allSettled([summaryPromise, detailPromise])
+8 -1
View File
@@ -593,6 +593,13 @@ export function useLeafletMap({
}
async function maybeAutoShowNearbyStations() {
if (selectedCity && isLoadingDetail) {
autoNearbyCityRef.current = selectedCity;
clearNearbyRefreshTimer();
layer.clearLayers();
return;
}
if (handlingAutoNearbyRef.current) {
return;
}
@@ -700,7 +707,7 @@ export function useLeafletMap({
map.off("zoomend", syncVisibility);
map.off("moveend", maybeAutoShowNearbyStations);
};
}, [cityDetailsByName, selectedCity, selectedDetail, suspendMotion]);
}, [cityDetailsByName, selectedCity, selectedDetail, suspendMotion, isLoadingDetail]);
// Centralized City Selection Zoom Effect
// Higher level than selection: we only flyTo once the data is loaded (selectedDetail)