From aa9171ce2c1d266b66b1552b76d5ad23affc038c Mon Sep 17 00:00:00 2001 From: hailin Date: Mon, 29 Dec 2025 11:37:09 -0800 Subject: [PATCH] =?UTF-8?q?fix(service-party-app):=20=E4=BF=AE=E5=A4=8D=20?= =?UTF-8?q?threshold=20=E4=B8=BA=20undefined=20=E5=AF=BC=E8=87=B4=E7=9A=84?= =?UTF-8?q?=E5=B4=A9=E6=BA=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题: - Session.tsx 直接访问 session.threshold.n 和 session.threshold.t - 当后端返回的 session 数据中 threshold 为 undefined 时崩溃 修复: - 添加空值检查 session.threshold?.n || 0 - 阈值信息部分添加条件渲染 Generated with Claude Code Co-Authored-By: Claude Opus 4.5 --- .../services/service-party-app/src/pages/Session.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/mpc-system/services/service-party-app/src/pages/Session.tsx b/backend/mpc-system/services/service-party-app/src/pages/Session.tsx index a8fc8454..0dda488f 100644 --- a/backend/mpc-system/services/service-party-app/src/pages/Session.tsx +++ b/backend/mpc-system/services/service-party-app/src/pages/Session.tsx @@ -187,7 +187,7 @@ export default function Session() { {/* 参与方列表 */}

- 参与方 ({(session.participants || []).length} / {session.threshold.n}) + 参与方 ({(session.participants || []).length} / {session.threshold?.n || 0})

{(session.participants || []).map((participant, index) => ( @@ -201,7 +201,7 @@ export default function Session() {
))} - {Array.from({ length: Math.max(0, session.threshold.n - (session.participants || []).length) }).map((_, index) => ( + {Array.from({ length: Math.max(0, (session.threshold?.n || 0) - (session.participants || []).length) }).map((_, index) => (
#{(session.participants || []).length + index + 1} @@ -214,6 +214,7 @@ export default function Session() {
{/* 阈值信息 */} + {session.threshold && (

阈值设置

@@ -225,6 +226,7 @@ export default function Session() {
+ )} {/* 完成状态 */} {session.status === 'completed' && session.publicKey && (