MCPcopy Create free account
hub / github.com/adobe/react-spectrum / visitNode

Function visitNode

packages/react-stately/src/table/useTreeGridState.ts:203–220  ·  view source on GitHub ↗
(node: GridNode<T>)

Source from the content-addressed store, hash-verified

201
202 // Update each grid node in the treegrid table with values specific to a treegrid structure. Also store a set of flattened row nodes for TableCollection to consume
203 let visitNode = (node: GridNode<T>) => {
204 if (node.type === 'item') {
205 flattenedRows.push(node);
206 }
207
208 keyMap.set(node.key, node);
209
210 for (let child of node.childNodes) {
211 if (!(child.type === 'item' && expandedKeys !== 'all' && !expandedKeys.has(node.key))) {
212 if (child.type === 'item') {
213 visitNode(child);
214 } else {
215 // We enforce that the cells come before rows so can just reuse cell index
216 visitNode(child);
217 }
218 }
219 }
220 };
221
222 for (let node of topLevelRows) {
223 visitNode(node as GridNode<T>);

Callers 1

Calls 3

pushMethod · 0.80
hasMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected