fix: use actual root node ID in orphan validation check

AI-generated trees use descriptive IDs (e.g., "verify-account-exists")
instead of "root", causing the root node to be falsely flagged as orphaned.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-03-06 23:06:07 -05:00
parent 64c22a0f71
commit f8867d83f8

View File

@@ -855,7 +855,7 @@ export const useTreeEditorStore = create<TreeEditorState>()(
// Check for orphaned nodes (not root and not referenced)
allNodeIds.forEach(id => {
if (id !== 'root' && !referencedIds.has(id)) {
if (id !== state.treeStructure?.id && !referencedIds.has(id)) {
// Check if it's a direct child of another node (via children array)
let isChildOfAny = false
const checkIfChild = (node: TreeStructure) => {