fix(ui): 转换 Big 对象为原生数字修复服务端序列化报错,并补充 Fragment key 修复列表渲染警告

This commit is contained in:
kennethcheng 2026-04-29 09:56:42 +08:00
parent eaeb143190
commit a408cad494
2 changed files with 5 additions and 5 deletions

View File

@ -1,6 +1,6 @@
'use client';
import { useState, useEffect, useTransition } from 'react';
import React, { useState, useEffect, useTransition } from 'react';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import {
Table,
@ -214,8 +214,8 @@ export default function DashboardPage() {
const isExpanded = !!expandedIds[pos.assetId];
return (
<>
<TableRow key={pos.assetId} className="cursor-pointer" onClick={() => toggleExpand(pos.assetId)}>
<React.Fragment key={pos.assetId}>
<TableRow className="cursor-pointer" onClick={() => toggleExpand(pos.assetId)}>
<TableCell>
<div className="flex flex-col">
<span className="font-semibold">{pos.name || pos.symbol}</span>
@ -361,7 +361,7 @@ export default function DashboardPage() {
</TableCell>
</TableRow>
)}
</>
</React.Fragment>
);
})}
</TableBody>

View File

@ -432,7 +432,7 @@ export async function getPortfolioSummary() {
const chartData = positions.map((pos, index) => ({
name: pos.symbol,
value: new Big(pos.cnyValue),
value: new Big(pos.cnyValue).toNumber(),
fill: [
'#3b82f6',
'#8b5cf6',