From 49d12d9a6446ceb8da702d53eb6231bc6a21741c Mon Sep 17 00:00:00 2001 From: AskaEth Date: Sat, 3 Oct 2026 19:17:26 +0800 Subject: [PATCH] =?UTF-8?q?fix(admin):=20=E4=BF=AE=E4=B8=8A=E4=B8=80?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E7=9A=84=E7=B1=BB=E5=9E=8B=E9=94=99=E8=AF=AF?= =?UTF-8?q?=20=E2=80=94=20channelListState=20=E6=94=B9=E4=B8=BA=E6=B3=9B?= =?UTF-8?q?=E5=9E=8B=EF=BC=9B=E4=BB=AA=E8=A1=A8=E7=9B=98=E4=B8=89=E6=80=81?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 上一提交(52ee8e5)带着 tsc 错误被推上去了(我的校验顺序写错:set -e 在 build 之后)。本提交修掉并把「先绿后提」做对。 - channelStatus.ts:channelListState 改为泛型 (它只判 null/error,与元素类型无关),使仪表盘能对任意列表复用同一套「读不到 ≠ 0」判定;既有调用点行为不变 - Dashboard.tsx:六个 HTTP 卡片(人格/会话/记忆/插件/渠道/IoT)由 data ?? [] + ?? 0 改为复用该三态:unknown → 「—」+「读取失败(与后端失联)」(warn)、pending → 「—」+「读取中…」;WS 驱动的 Agent/后台思考卡片不变 - 验收:npm run build 绿(先跑后提)+ channelStatus 45 断言 + messageSync 54 断言 --- frontend/web/src/admin/modules/channels/channelStatus.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/web/src/admin/modules/channels/channelStatus.ts b/frontend/web/src/admin/modules/channels/channelStatus.ts index 2cd9aa4..906333e 100644 --- a/frontend/web/src/admin/modules/channels/channelStatus.ts +++ b/frontend/web/src/admin/modules/channels/channelStatus.ts @@ -31,8 +31,8 @@ export type ChannelListState = "ready" | "pending" | "unknown"; /** List-level tri-state: a list we never read plus a recorded error is *unknown*, * never "empty". `data == null` with no error is the first load still running. */ -export function channelListState( - data: readonly AdminChannelRecord[] | null, +export function channelListState( + data: readonly T[] | null, error: string | null, ): ChannelListState { if (data != null) return "ready";