fix(ui): 对齐图表末端与实时概览数据的精度,放开全量历史趋势查询限制
This commit is contained in:
+15
-2
@@ -109,7 +109,20 @@ export default function DashboardPage() {
|
||||
useEffect(() => {
|
||||
async function loadSnapshots() {
|
||||
await recordDailySnapshot();
|
||||
const data = await getSnapshots({ limit: 30 });
|
||||
const summary = await getPortfolioSummary();
|
||||
const data = await getSnapshots();
|
||||
const todayStr = new Date().toISOString().slice(0, 10);
|
||||
const lastSnapshot = data[data.length - 1];
|
||||
if (lastSnapshot && lastSnapshot.date === todayStr) {
|
||||
lastSnapshot.totalValueCny = summary.totalCnyValue;
|
||||
lastSnapshot.totalCostCny = summary.totalCnyValue;
|
||||
} else {
|
||||
data.push({
|
||||
date: todayStr,
|
||||
totalValueCny: summary.totalCnyValue,
|
||||
totalCostCny: summary.totalCnyValue,
|
||||
});
|
||||
}
|
||||
setSnapshots(data);
|
||||
}
|
||||
loadSnapshots();
|
||||
@@ -212,7 +225,7 @@ export default function DashboardPage() {
|
||||
toast.dismiss();
|
||||
if (result.success) {
|
||||
toast.success(`重构成功,已填充 ${result.daysReconstructed} 天历史数据`);
|
||||
setSnapshots(await getSnapshots({ limit: 30 }));
|
||||
setSnapshots(await getSnapshots());
|
||||
} else if (result.message) {
|
||||
toast.info(result.message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user