( state: TreeState<T>, id: string )
| 136 | } |
| 137 | |
| 138 | function collapseNode<T extends { id: string; children?: T[] }>( |
| 139 | state: TreeState<T>, |
| 140 | id: string |
| 141 | ): TreeState<T> { |
| 142 | const collapsedState = { |
| 143 | ...state.collapsedState, |
| 144 | [id]: true, |
| 145 | }; |
| 146 | |
| 147 | return { |
| 148 | ...state, |
| 149 | collapsedState, |
| 150 | items: createNodeItems(state.nodes, 0, collapsedState), |
| 151 | focusedNodeId: id, |
| 152 | }; |
| 153 | } |
| 154 | function toggleAllChildren<T extends { id: string; children?: T[] }>( |
| 155 | state: TreeState<T>, |
| 156 | id: string |
no test coverage detected