Skip to content

Commit

Permalink
guard against empy array in remove
Browse files Browse the repository at this point in the history
  • Loading branch information
LFDanLu committed Feb 8, 2024
1 parent 8377a7c commit 2103dd1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/@react-stately/data/src/useTreeData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ export function useTreeData<T extends object>(options: TreeOptions<T>): TreeData
}
},
remove(...keys: Key[]) {
if (keys.length === 0) {
return;
}

let newItems = items;
let prevMap = nodeMap;
let newTree;
Expand Down

0 comments on commit 2103dd1

Please sign in to comment.