From ec3bfa03ef1457d7e4a9f9da4e81f60232a198fa Mon Sep 17 00:00:00 2001 From: zenchantlive <103866469+zenchantlive@users.noreply.github.com> Date: Thu, 12 Feb 2026 23:59:52 -0800 Subject: [PATCH] Update src/lib/graph-view.ts Co-authored-by: qodo-free-for-open-source-projects[bot] <189517486+qodo-free-for-open-source-projects[bot]@users.noreply.github.com> --- src/lib/graph-view.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/lib/graph-view.ts b/src/lib/graph-view.ts index 5b8229c..d9f7dcf 100644 --- a/src/lib/graph-view.ts +++ b/src/lib/graph-view.ts @@ -389,19 +389,24 @@ export function analyzeBlockedChain(model: GraphModel, options: { focusId: strin } const blockers = blockerNodeIds.map(id => model.nodes.find(n => n.id === id)).filter(Boolean) as GraphNode[]; + const nodeById = new Map(model.nodes.map((n) => [n.id, n])); + const blockers = blockerNodeIds.map(id => nodeById.get(id)).filter(Boolean) as GraphNode[]; const openBlockers = blockers.filter((b) => b.status !== 'closed'); const inProgress = openBlockers.filter((b) => b.status === 'in_progress'); - const openCount = openBlockers.filter(b => b.status === 'open' || b.status === 'blocked').length; - + const firstActionable = openBlockers.find((b) => { const adj = model.adjacency[b.id]; if (!adj) return true; - return !adj.incoming.some(e => e.type === 'blocks' && model.nodes.find(n => n.id === e.source)?.status !== 'closed'); + return !adj.incoming.some(e => { + if (e.type !== 'blocks') return false; + const sourceNode = nodeById.get(e.source); + return sourceNode?.status !== 'closed'; + }); }); return { blockerNodeIds: blockerNodeIds.sort(), - openBlockerCount: openCount, + openBlockerCount: openBlockers.length, inProgressBlockerCount: inProgress.length, firstActionableBlockerId: firstActionable?.id ?? null, chainEdgeIds: chainEdgeIds.sort(),