fix(web): normalize null trace arrays before render
ProjectTracePanel reads index.length; a cached or older payload of null must not crash the page. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -40,7 +40,13 @@ export async function fetchProjectTrace(projectId: number): Promise<ProjectTrace
|
||||
if (!res.ok) {
|
||||
throw new Error(`需求与影响加载失败: ${res.status}`);
|
||||
}
|
||||
return res.json();
|
||||
const data = await res.json();
|
||||
return {
|
||||
items: Array.isArray(data.items) ? data.items : [],
|
||||
hidden_count: typeof data.hidden_count === 'number' ? data.hidden_count : 0,
|
||||
index: Array.isArray(data.index) ? data.index : [],
|
||||
recheck_marks: Array.isArray(data.recheck_marks) ? data.recheck_marks : [],
|
||||
};
|
||||
}
|
||||
|
||||
export async function clearRecheckMark(projectId: number, markId: number, reason: 'no_change' | 'revision_started'): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user