diff --git a/src/stores/project.ts b/src/stores/project.ts index e032be8..d3ba025 100644 --- a/src/stores/project.ts +++ b/src/stores/project.ts @@ -211,6 +211,10 @@ function createStore() { try { // 固时间戳(FR-C1):formattedEvents computed 重算时用事件发生时刻,非当前时刻 state.liveEvents.push({ ...payload, _ts: Date.now() }) + // 限长(FR-R3):防 liveEvents 无限增长撑爆内存,保留最近 200 条 + if (state.liveEvents.length > 200) { + state.liveEvents.splice(0, state.liveEvents.length - 200) + } // 处理人工审批请求 // WorkflowEvent serde tag=type rename_all=snake_case → type='human_approval_request',字段扁平(无 data 包装)(B-03b-R7) if (payload.event?.type === 'human_approval_request') {