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

Function update

packages/react-stately/src/data/useTreeData.ts:453–473  ·  view source on GitHub ↗
(oldKey: Key, newValue: T)

Source from the content-addressed store, hash-verified

451 });
452 },
453 update(oldKey: Key, newValue: T) {
454 setItems(({items, nodeMap: originalMap}) =>
455 updateTree(
456 items,
457 oldKey,
458 oldNode => {
459 let node: TreeNode<T> = {
460 key: oldNode.key,
461 parentKey: oldNode.parentKey,
462 value: newValue,
463 children: null
464 };
465
466 let tree = buildTree(getChildren(newValue), originalMap, node.key);
467 node.children = tree.items;
468 return node;
469 },
470 originalMap
471 )
472 );
473 }
474 };
475}
476

Callers 1

updateTreeFunction · 0.70

Calls 3

updateTreeFunction · 0.85
buildTreeFunction · 0.85
getChildrenFunction · 0.85

Tested by

no test coverage detected