[refactor] Extract executionErrorStore from executionStore (#9060)

## Summary
Extracts error-related state and logic from `executionStore` into a
dedicated `executionErrorStore` for better separation of concerns.

## Changes
- **New store**: `executionErrorStore` with all error state
(`lastNodeErrors`, `lastExecutionError`, `lastPromptError`), computed
properties (`hasAnyError`, `totalErrorCount`,
`activeGraphErrorNodeIds`), and UI state (`isErrorOverlayOpen`,
`showErrorOverlay`, `dismissErrorOverlay`)
- **Moved util**: `executionIdToNodeLocatorId` extracted to
`graphTraversalUtil`, reusing `traverseSubgraphPath` and accepting
`rootGraph` as parameter
- **Updated consumers**: 12 files updated to import from
`executionErrorStore`
- **Backward compat**: Deprecated getters retained in `ComfyApp` for
extension compatibility

## Review Focus
- Deprecated getters in `app.ts` — can be removed in a future
breaking-change PR once extension authors migrate

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-9060-refactor-Extract-executionErrorStore-from-executionStore-30e6d73d36508101973de835ab6b199f)
by [Unito](https://www.unito.io)
This commit is contained in:
jaeone94
2026-02-22 09:51:22 +09:00
committed by GitHub
parent d9fdb01d9b
commit 8aa4e36fd5
20 changed files with 425 additions and 373 deletions

View File

@@ -4,7 +4,10 @@ import type {
Subgraph
} from '@/lib/litegraph/src/litegraph'
import type { NodeExecutionId, NodeLocatorId } from '@/types/nodeIdentification'
import { parseNodeLocatorId } from '@/types/nodeIdentification'
import {
createNodeLocatorId,
parseNodeLocatorId
} from '@/types/nodeIdentification'
import { isSubgraphIoNode } from './typeGuardUtil'
@@ -359,6 +362,36 @@ export function getNodeByLocatorId(
return targetSubgraph.getNodeById(localNodeId) || null
}
/**
* Convert execution context node IDs to NodeLocatorIds.
* Uses traverseSubgraphPath to resolve the subgraph chain.
*
* @param rootGraph - The root graph to resolve against
* @param nodeId - The node ID from execution context (could be execution ID like "123:456:789")
* @returns The NodeLocatorId, or undefined if resolution fails
*/
export function executionIdToNodeLocatorId(
rootGraph: LGraph,
nodeId: string | number
): NodeLocatorId | undefined {
const nodeIdStr = String(nodeId)
if (!nodeIdStr.includes(':')) {
// It's a top-level node ID
return nodeIdStr
}
// It's an execution node ID — resolve subgraph path
const parts = nodeIdStr.split(':')
const localNodeId = parts.at(-1)!
const subgraphPath = parts.slice(0, -1)
const targetGraph = traverseSubgraphPath(rootGraph, subgraphPath)
if (!targetGraph) return undefined
return createNodeLocatorId(targetGraph.id, localNodeId)
}
/**
* Finds the root graph from any graph in the hierarchy.
*