fix: 三致命Bug—macro_status预计算+排除已完工脏读+flush落盘+递归深度限制10
This commit is contained in:
@ -271,12 +271,24 @@ interface CommonProps {
|
||||
onViewRecords: (t: TaskResponse) => void;
|
||||
}
|
||||
|
||||
const MAX_DEPTH = 10; // 🔧 防爆栈:递归深度上限
|
||||
|
||||
const TaskNode = memo(function TaskNode({
|
||||
task, isBranch, common,
|
||||
task, isBranch, common, depth = 0,
|
||||
}: {
|
||||
task: TaskResponse; isBranch: boolean;
|
||||
common: CommonProps;
|
||||
common: CommonProps; depth?: number;
|
||||
}) {
|
||||
// 🔧 防循环引用/脏数据导致死循环
|
||||
if (depth > MAX_DEPTH) {
|
||||
return (
|
||||
<div className="w-56 shrink-0 rounded-xl border-2 border-red-300 bg-red-50 p-3 text-center">
|
||||
<p className="text-[10px] font-bold text-red-500">⚠ 树深度超限</p>
|
||||
<p className="mt-1 text-[9px] text-red-400">请检查数据完整性</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const isActive = task.status?.toUpperCase() === TASK_STATUS.PENDING
|
||||
|| task.status?.toUpperCase() === TASK_STATUS.WIP;
|
||||
|
||||
@ -320,7 +332,7 @@ const TaskNode = memo(function TaskNode({
|
||||
{/* 横线连接 */}
|
||||
<div className="absolute left-[108px] top-6 w-6 h-0.5 bg-gray-200" />
|
||||
<div className="ml-6">
|
||||
<TaskNode task={child} isBranch={false} common={common} />
|
||||
<TaskNode task={child} isBranch={false} common={common} depth={depth + 1} />
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user