| 453 | } |
| 454 | |
| 455 | function moveToChildren(state: ColumnViewState): ColumnViewState { |
| 456 | const { highlightedNodeId } = state; |
| 457 | |
| 458 | if (!highlightedNodeId) { |
| 459 | return state; |
| 460 | } |
| 461 | |
| 462 | const highlightedNode = state.nodeTable[highlightedNodeId]; |
| 463 | |
| 464 | if (!highlightedNode || highlightedNode.children.length === 0) { |
| 465 | return state; |
| 466 | } |
| 467 | |
| 468 | const id = highlightedNode.children[0]; |
| 469 | |
| 470 | return { |
| 471 | ...state, |
| 472 | selectedNodeId: id, |
| 473 | highlightedNodeId: id, |
| 474 | }; |
| 475 | } |
| 476 | |
| 477 | // TODO: CACHE THIS |
| 478 | function generateColumns( |