(nodeId: string)
| 268 | |
| 269 | // 递归构建路径到节点的函数 |
| 270 | const buildPathToNode = (nodeId: string): string[] => { |
| 271 | const node = updatedMessages.find((msg) => msg.id === nodeId) |
| 272 | if (!node) return [] |
| 273 | if (!node.parentId) return [nodeId] |
| 274 | const parentPath = buildPathToNode(node.parentId) |
| 275 | return [...parentPath, nodeId] |
| 276 | } |
| 277 | |
| 278 | // 递归向下找到最新子节点的函数 |
| 279 | const extendPathToLeaf = (path: string[]): string[] => { |