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

View File

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