perf: reuse mileage monitoring snapshots
This commit is contained in:
@@ -565,7 +565,7 @@ export default function MonitoringView() {
|
||||
}, [filterTargetNames]);
|
||||
|
||||
// 加载首页数据
|
||||
const loadFirstPage = useCallback((showPageLoading = true) => {
|
||||
const loadFirstPage = useCallback((showPageLoading = true, force = false) => {
|
||||
if (showPageLoading) setPageLoading(true);
|
||||
setPageError(null);
|
||||
return fetchMonitoring({
|
||||
@@ -589,6 +589,7 @@ export default function MonitoringView() {
|
||||
endDate: rangeEnd || undefined,
|
||||
brands: filterBrands.length > 0 ? filterBrands : undefined,
|
||||
sourcePriority,
|
||||
force,
|
||||
}).then(d => {
|
||||
setVehicles(d.vehicles);
|
||||
setStats(d.stats);
|
||||
@@ -613,7 +614,7 @@ export default function MonitoringView() {
|
||||
if (manualRefreshing) return;
|
||||
setManualRefreshing(true);
|
||||
try {
|
||||
await loadFirstPage(false);
|
||||
await loadFirstPage(false, true);
|
||||
} finally {
|
||||
setManualRefreshing(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user