fix(admin): 修上一提交的类型错误 — channelListState 改为泛型;仪表盘三态化
上一提交(52ee8e5)带着 tsc 错误被推上去了(我的校验顺序写错:set -e 在 build 之后)。本提交修掉并把「先绿后提」做对。 - channelStatus.ts:channelListState 改为泛型 <T>(它只判 null/error,与元素类型无关),使仪表盘能对任意列表复用同一套「读不到 ≠ 0」判定;既有调用点行为不变 - Dashboard.tsx:六个 HTTP 卡片(人格/会话/记忆/插件/渠道/IoT)由 data ?? [] + ?? 0 改为复用该三态:unknown → 「—」+「读取失败(与后端失联)」(warn)、pending → 「—」+「读取中…」;WS 驱动的 Agent/后台思考卡片不变 - 验收:npm run build 绿(先跑后提)+ channelStatus 45 断言 + messageSync 54 断言
This commit is contained in:
1 parent
52ee8e53aa
commit
49d12d9a64
1 file changed
+2
-2
@@ -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<T>(
|
||||
data: readonly T[] | null,
|
||||
error: string | null,
|
||||
): ChannelListState {
|
||||
if (data != null) return "ready";
|
||||
|
||||
Reference in new issue
Block a user