fix: analysis 500s, caching, alert page perf
P0: Fix KeyError in 3 analysis endpoints. geojson.py stores 1d risk as "risk_value" but analysis.py accessed "risk_1d" — always crashed. Backend: Add lru_cache to GeoJSON/CSV/Parquet loaders, date helpers, and district loader. Add try/except and FileNotFoundError guards. Frontend: Debounce riskRange, merge counts into useMemo, stabilize handleGridClick with ref, memoize nearest-grid scan, wrap AlertMap in React.memo, switch useLodGrid from fetch to cachedGet.
This commit is contained in:
@@ -87,7 +87,7 @@ api.interceptors.response.use(
|
||||
}
|
||||
);
|
||||
|
||||
async function cachedGet<T>(url: string, params?: Record<string, any>): Promise<T> {
|
||||
export async function cachedGet<T>(url: string, params?: Record<string, any>): Promise<T> {
|
||||
const key = getCacheKey(url, params);
|
||||
const cached = getCached<T>(key);
|
||||
if (cached !== undefined) return cached;
|
||||
|
||||
Reference in New Issue
Block a user