Skip to content

Commit

Permalink
update replaceAll to setRootItems
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-clayburn committed Mar 7, 2025
1 parent 6700e78 commit 296cc63
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/@react-stately/data/src/useTreeData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export interface TreeData<T extends object> {
* Replace the whole tree.
* @param newItems - The new items to replace the tree with.
*/
replaceAll(newItems: T[]): void,
setRootItems(newItems: T[]): void,
/**
* Inserts an item into a parent node as a child.
* @param parentKey - The key of the parent item to insert into. `null` for the root.
Expand Down Expand Up @@ -262,7 +262,7 @@ export function useTreeData<T extends object>(options: TreeOptions<T>): TreeData
getItem(key: Key) {
return nodeMap.get(key);
},
replaceAll(newItems: T[]) {
setRootItems(newItems: T[]) {
setItems(buildTree(newItems, new Map()));
},
insert(parentKey: Key | null, index: number, ...values: T[]) {
Expand Down

0 comments on commit 296cc63

Please sign in to comment.