(id: string)
| 335 | }; |
| 336 | |
| 337 | const toggleExpand = (id: string) => { |
| 338 | const node = nodesById.get(id); |
| 339 | if (node == null || !node.isDirectory || node.notfound || node.staterror) { |
| 340 | return; |
| 341 | } |
| 342 | const expanded = expandedIds.has(id); |
| 343 | if (!expanded) { |
| 344 | loadChildren(id); |
| 345 | } |
| 346 | setExpandedIds((prev) => { |
| 347 | const next = new Set(prev); |
| 348 | if (expanded) { |
| 349 | next.delete(id); |
| 350 | } else { |
| 351 | next.add(id); |
| 352 | } |
| 353 | return next; |
| 354 | }); |
| 355 | scrollToId(id); |
| 356 | }; |
| 357 | |
| 358 | const selectVisibleNodeAt = (index: number) => { |
| 359 | if (index < 0 || index >= visibleRows.length) { |
no test coverage detected