(collection: Collection<Node<unknown>>, route: string)
| 710 | // The collection key of the item whose href matches `route`, or null. getKeys() covers collapsed |
| 711 | // items too, and the href is stored as a data attribute so it doesn't trigger Tree's link handling. |
| 712 | function findKeyForRoute(collection: Collection<Node<unknown>>, route: string): Key | null { |
| 713 | for (let key of collection.getKeys()) { |
| 714 | if (collection.getItem(key)?.props?.href === route) { |
| 715 | return key; |
| 716 | } |
| 717 | } |
| 718 | return null; |
| 719 | } |
| 720 | |
| 721 | // Walks up from `key` to the closest ancestor that is actually rendered (i.e. all of its ancestors |
| 722 | // are expanded). Returns `key` unchanged when it is already visible. A collapsed ancestor hides |
no test coverage detected