From c9ef3c0f0a40e23d8d7c175a81ccded3b5e15ad7 Mon Sep 17 00:00:00 2001 From: weichen Date: Fri, 16 Oct 2026 15:31:52 +0000 Subject: [PATCH] Unwrap projects payload in cockpit project loader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Why: rdm.project.list returns { projects: [...] }; the cockpit component assumed a bare array and always rendered 暂无可见研发项目, caught by I4 e2e scenario 1. Evidence: tsc/vitest/build green (SELF); browser e2e rerun recorded on the Dev I4 card. Impact: cockpit entry only. Refs: rollout I4 --- src/components/DocumentCockpit.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/DocumentCockpit.tsx b/src/components/DocumentCockpit.tsx index 1730f21..8f33889 100644 --- a/src/components/DocumentCockpit.tsx +++ b/src/components/DocumentCockpit.tsx @@ -64,8 +64,13 @@ export function DocumentCockpit() { useEffect(() => { let c = false setProjects(null); setPid(''); setOverview(null); setSelected(null); setFilter(''); setError('') - api.rdmCommand('rdm.project.list') - .then(list => { if (!c) setProjects(Array.isArray(list) ? list : []) }) + api.rdmCommand<{ projects?: ProjectView[] } | ProjectView[]>('rdm.project.list') + .then(list => { + if (!c) return + // rdm.project.list 返回 { projects: [...] };容忍裸数组形态。 + const rows = Array.isArray(list) ? list : (list?.projects ?? []) + setProjects(rows) + }) .catch(e => { if (!c) setError(e.message) }) return () => { c = true } }, [identity]) -- 2.54.0